Browse by category:
|| | ||
How do I force text to be stored as a string (GX_VT_STRING value type) for individual cells when formula support is enabled?
The formula engine parses the string that gets entered into a edit cell and when it is a valid number, the engine will store the value as plain number. Leading zeros and trailing digits will be ignored.
The user can force the input to be stored as string by inserting an apostrophe before the number. However, this is sometimes not a sufficient solution.
If you want to programmatically force individual cells always to be stored as string, override the StoreStyleRowCol() method as follows:
|BOOL CMyFormulaGrid::StoreStyleRowCol(ROWCOL nRow, ROWCOL nCol, const CGXStyle* pStyle, GXModifyType mt, int nType)
|if (nRow and nCol meets your criteria)|
|nType = 0;|
|return CGXGridCore::StoreStyleRowCol(nRow, nCol, pStyle, mt, 0);|
If nType is equal to zero the formula engine will not parse the value and store the value as string.
See the class reference for SetExpressionRowCol(), SetTextRowCol() and SetFormatRowCol() for more information.
|Objective Grid: Changing header labels||Objective Grid: How can I change the default settings for all...|