<< Return to Main Index

< Return to Class Index

CGXFormulaSheet::SetNumberRowCol

BOOL SetNumberRowCol(ROWCOL nRow, ROWCOL nCol, double number);

nRow

Specifies the grid row of the cell.

nCol

Specifies the grid column of the cell.

number

The number to be stored in the cell

Return Value

TRUE if operation was successful; FALSE otherwise.

Remarks

Assigns a number to a cell. The value type for the cell will be set to Number.

CGXGridCore::SetValueRange and SetExpressionRowCol will call this method for number 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::SetTextRowCol CGXFormulaSheet::SetExpressionRowCol

CGXFormulaSheet

Class Overview | Class Members