Set the SubFormat used by a column.
BOOL SetSubFormat( int iSubFormat, int iFormatToUse = -1 )
TRUE if set the column subformat successfully, otherwise FALSE.
An error occurs when a subformat is out of range. For example, any value for a Text column or a value greater than 21 for a Date column.
EX1
// Get the active worksheet, set column Format as DATE and set it's SubFormats void Column_SetSubFormat_Ex1() { Worksheet wks = Project.ActiveLayer(); if (!wks) return; Column colA(wks, 0); colA.SetFormat(OKCOLTYPE_DATE); // Column Format is DATE colA.SetSubFormat(13); // The 14th SubFormat (value = 13) of DATE is yyMMdd HH:mm:ss }
EX2
// Get the active worksheet, set column Format as NUMERIC and set it's SubFormats void Column_SetSubFormat_Ex2() { Worksheet wks = Project.ActiveLayer(); if (!wks) return; Column colB(wks, 1); colB.SetFormat(OKCOLTYPE_NUMERIC); // Column Format is NUMERIC colB.SetSubFormat(3); // The 4th SubFormat (value = 3) of NUMERIC is Decimal: 1,000 }
Each Format have some SubFormat, you can choose different Format in the Worksheet Column Properties dialog and see the SubFormat corresponding to that Format at the 'Display' label. The GetSubFormat and SetSubFormat function will return or use the index of the combo box in the label to represent different SubFormat.
origin.h