CGXFormulaSheet::SetTextRowCol
BOOL SetTextRowCol(ROWCOL nRow, ROWCOL nCol, LPCTSTR pszText);
nRow
Specifies the grid row of the cell.
nCol
Specifies the grid column of the cell.
pszText
Points to the text label that should be assigned to the cell.
Remarks
Assigns a text label to a cell. The value type will become string.
CGXGridCore::SetValueRange and SetExpressionRowCol will call this method for text values after checking the cell is not readonly and notifying the cell object of the change.
Call this method directly if you want to initialize the grid with a large data-sets. The speed improvements will be enormous compared to calling SetValueRange or SetExpressionRowCol for each cell. But be aware that cells are not checked if they are read-only, cell objects are not notified and no undo information will be created.
Example:
// Performace tests:
// Using SetNumberRowCol/SetTextRowCol directly
// instead of SetValueRange or SetExpressionRowCol
// will speed up the initialization of the grid
// enormously (just as fast as filling an array).
//
// Check it out below!
//
// NOTE: Directly calling these methods will bypass the
// notification of the associated cell type object for a
// cell (CGXControl::StoreStyle will not be called) and
// the readonly state of the cell will also not be
// checked.
//
DWORD ti = GetTickCount();
CGXFormulaSheet* pSheet = GetSheetContext();
CGXStyle style;
for (; nRow < 300; nRow++)
{
for (ROWCOL nCol = 1; nCol < 10; nCol++)
{
CString s;
s.Format("%d/%d", nRow/100, nCol);
// style.SetValue("Hello");
// StoreStyleRowCol(nRow, nCol, &style, gxOverride, 0);
// pSheet->SetNumberRowCol(nRow, nCol, (double) nRow+nCol);
pSheet->SetTextRowCol(nRow, nCol, _T("Hello"));
}
}
CString msg;
msg.Format("%d Ticks", GetTickCount()-ti);
AfxMessageBox(msg);
See Also
CGXFormulaSheet::SetNumberRowCol CGXFormulaSheet::SetExpressionRowCol,