<< Return to Main Index

< Return to Class Index

CGXFormulaSheet::SetExpressionRowCol

BOOL SetExpressionRowCol(ROWCOL nRow, ROWCOL nCol, LPCTSTR pszInput);

nRow

Specifies the grid row of the cell.

nCol

Specifies the grid column of the cell.

pszInput

The expression string to be interpreted

Return Value

TRUE if operation was successful; FALSE otherwise.

Remarks

Parses the given text and based on the text content assigns a formula, a text label or a number to the specified cell. To force numeric or date values to be stored as string, insert an apostrophe ("'")  at the beginning of the text. Formulas must start with an equal sign ('='). If an error happens while parsing the formula, the error state for the engine will contain detailed information about the error.

SetExpressionRowCol also checks if the input is a date/time string and if this is the case parses the string and stores the date/time as a number together with formatting information (CGXStyle::SetFormat). The formatting information will then either be date or time.

Objective Grid internally stores date and time information using the same convention as other popular spreadsheet programs: Dates are represented as an integer equal to the number of days since December 31, 1899. Times are represented as fractions of a day, starting at midnight. For example, 6:00 AM is stored as 0.25 (a quarter of a 24-hour day). Using this convention, date and time values may be used together. For example, the date/time value 1.25 corresponds to 6:00:00 AM, January 1, 1900.

Example:

      SetExpressionRowCol(nRow, 1, _T("STRCAT"));
      SetExpressionRowCol(nRow+1, 1, _T("=STRCAT(F7, G7)"));

See Also

CGXStyle::SetFormat

CGXFormulaSheet

Class Overview | Class Members