TE Edit Control .NET Core / .NET Framework Help
Product page

TerCreateCellId

Create a cell id.

int TerCreateCellId( NewRow, PrevCell, RowAlign, RowPos, RowMinHeight, CellWidth, shading, LeftWidth, RightWidth, TopWidth, BotWidth, RowSpan, ColSpan, flags)
bool NewRow; Set to true when creating the first cell of a new row.
int PrevCell;Set this value to 0 when creating the first cell id for first row of the table. Otherwise set it to the cell id of the previous cell in the table.
int RowAlign;LEFT,RIGHT, CENTER. (set to 0 for default).
int RowPos;Row position in twips (set to 0 for default).
int RowMinHeight;Minimum row height in twips (set to 0 for default).
int CellWidth;Cell width in twips.
int shading;Shading percentage (set to 0 for default)
int LeftWidth;The left border width (set to 0 for default).
int RightWidth;The right border width (set to 0 for default).
int TopWidth;The top border width (set to 0 for default).
int BotWidth;The bottom border width (set to 0 for default).
int RowSpan;Number of rows spanned by the cell (set to 1 for default).
int ColSpan;Number of columns spanned by the cell (set to 1 for default).
int flags;CFLAG_ constants defined in the ter.h file (set to 0 for default).

Description: This function is used to create a new cell id. This function is useful for creating tables very efficiently.

The following example creates a 3 row by 2 column table:

 int PrevCell,CellId;
 bool NewRow;
 string str;
 PrevCell=CellId=0;
 for (int row=0;row<3;row++) {
   for (int col=0;col<2;col++) {
     if (col==0) NewRow=true;
     else NewRow=false;
     CellId=toc.TerCreateCellId(NewRow,PrevCell,0,0,0,
                                2000,0,0,0,0,0,1,1,0);
     str = "cell text" + tc.CELL_CHAR.ToString();   // append
                              cell delimiter to the cell text
     toc.TerAppendTextEx(str,-1,-1,CellId,-1,false);
     PrevCell=CellId;
   }
   str = tc.ROW_CHAR.ToString();     // insert a row delimiter
   toc.TerAppendTextEx(str,-1,-1,CellId,-1,false);
 }  

Return Value: When successful, this function returns the id of the new cell. Otherwise it returns 0