How to move cursor into table

  • I need some help to move cursor between pre-designed table.

    First I find the start of the table

    WP.Finder.ToStart;
    While WP.Finder.Next('#starttoken#') do
    WP.SetSelPosLen(WP.Finder.FoundPosition, WP.Finder.FoundLength);

    now write something...

    wp.inputstring('Hello');

    then I want to go to next cell (like sending CHR(9) in Word), but inputstring does not handle TAB char, neither I find an easy way.

    Help please!

  • Cannot find anything in manual, nor PDF, nor CHM, but I use a simple

    Code
    wp.cpposition:=wp.cpposition+1;


    (very dirty, but effective)
    to simulate "right-arrow", plus "spreadsheet-mode" flag and

    Code
    WP.InsertRow

    to add another row, and a couple of

    Code
    Wp.inputstring(chr(127));

    to erase (eventually) empty space after the token.

    AFAIK there is not a function that, given the cursor "somewhere" (into a table), return the table name and/or the Tparagraph where the cursor itself is, so I cannot use par:=par.nextpar and so on.

    In this case the template RTF was written by Microsoft Word, thus without the "wpcubed table name"

    Thanx anyway for help

    • Offizieller Beitrag

    Please see the documentation of the data structures:


    The architecture is very powerful and allows it to quickly access any element in the text.

    Using the property ActiveParagraph You have access to the current paragraph. That can also be a cell or a sub paragraph of a cell.

    The properties TParagraph.ParentTable provide a reference to the parent table (which is also of type TParagraph) of all paragraph. In case of ActiveParagraph it is also possible to use the properties TableRow, Table and TableCell.

    This example creates a new row when ENTER is pressed at the last position of a row.