Set the number of columns and rows of worksheet
BOOL SetSize( int nNumRows, int nNumCols, DWORD dwCntrl = 0 )
TRUE on success and FALSE on failure.
EX1
// the following code will reset the active worksheet with 3000 enumerated cols void Worksheet_SetSize_Ex1() { Worksheet wks = Project.ActiveLayer(); if(wks) { wks.SetSize(-1,0); // delete existing columns wks.SetSize(1000,3000); // make a worksheet with 3000 cols with 1000 rows each } }
EX2
// a function to clear a worksheet // WARNING! Active worksheet data will be deleted void Worksheet_SetSize_Ex2() { Worksheet wks = Project.ActiveLayer(); if(wks) wks.SetSize(-1, -1, WSS_CLEAR_DATA); }
If nNumCols is larger then the current number of columns in the worksheet, then new columns will be added using enumerated column names which is faster then calling AddCol.
Also, Origin does not support small number of rows in worksheet display, so setting a value of nNumRows smaller then the height of the display will be ignored.
Worksheet::AddCol, Worksheet::DeleteCol, Worksheet::SetBounds
origin.h