Position Cursor at end of table

  • Can you help me with the following problem:

    I insert a table by code. Now i want to position the "cursor" right after the table to insert more text after the table. I tried

    while Assigned(Memo.Table) do CPPosition := CPPosition + 1;

    This works, if there is some text after the table. Problem is, that the table can be the last paragraph in my text so this does not work (endless loop).

    Do you have a suggestion/hint for me? Thanks!

    Andreas Obermüller

    • Offizieller Beitrag

    Hello,

    something like this can easily be made with the low level code:

    Code
    if WPRichText1.Table<>nil then
       begin
         if WPRichText1.Table.NextPar=nil then
         begin
             WPRichText1.ActiveParagraph := WPRichText1.Table.AppendNewPar(true);
             WPRichText1.ReformatAll(false, true);
         end
         else  WPRichText1.ActiveParagraph := WPRichText1.Table.NextPar;
         WPRichText1.SetFocus;
       end;

    Julian