MoveToTable Method

[Top]  [Chapter]  [Previous]  [Next]

Applies to

IWPTextCursor

Declaration

bool MoveToTable(string Name);

Description

 

Moves to a table with a given name. The methods AddTable and InputTable allow it to give the table a name. If no table was found the result value will be false.

 

   if (TextCursor.MoveToTable("MYTABLE"))

   {

      int val, sum = 0,i = 1;

      Random rnd = new Random();

      while(true)

      {

         TextCursor.CPTableColNr = 0// First Cell

         TextCursor.InputText(i.ToString());

         TextCursor.CPMoveNextCell();

         val = rnd.Next(1000);

         TextCursor.InputText(val.ToString());

         TextCursor.CPMoveNextCell();

         sum+=val;

         TextCursor.InputText(sum.ToString());

         if (!TextCursor.CPMoveNextRow(false)) break;

      }

   }

 

You may pass an empty string to locate the first table in the document. "{NESTEDTABLE}" will locate the first nested table in the current table cell. "{NEXTTABLE}" will locate the next table within the current nesting level. In case a table was found the cursor will be always moved into the first cell of the table.

Tip: You can use the methods ASetCellProp and ASetCellStyle to quickly modify the properties, text and styles of certain cells in an existing table.

 

To move to other named paragraphs use Memo.TextCommandStr(42, 0, name).


[idh_iwptextcursor_movetotable.htm]    Copyright © 2007 by WPCubed GmbH