Mailmerge insert HTML table - repeat header, borders

  • I am using mailmerge in WPTools 7 to insert HTML tables into a document, it works very good except for two things that just wouldn't work:

    1. Repeat header of the table on subsequent pages

    2. paint borders only between rows not around the table.

    Any hint is very appreciated!

    Thanks

    Michael

  • Would it be possible to access the created table from within the implementation of wpMailMergeGetText? Then I could code styles into the bookmarks and implement them on the resulting table object using the power of WPTools.

  • Unfortunately it just wouldnt work:

    I store all content.mergepar in wpMailMergeGetText for all tables I insert. Either in wpMailMergeGetText and after completion of the merge both parentRow and parentTable are NIL.

    How can I find the table objects I merged into?

  • Sorry that I did not make it clear.

    A template is loaded as docx, all the variables are just test phrases and are marked as bookmarks and get overwritten. One of the variables will be overwritten by a complete table served as html. I was hoping to find that table (or tables) later in the process along with theit bookmark names to do additional formatting like repeating headers and cell lines.

    It would be great if I could somehow access the (table-)object that was created by the merge process.

    Thanks

    Michael

    • Offizieller Beitrag

    You have access to all the paragraphs and tables, rows and cells after the text was created or modified.

    You can enumerate the paragraphs in a loop with

    par := WPRichText.FirstPar;

    while par<>nil do

    begin

    ..

    par := par.NextPar;

    end;

    This will find all first level paragraphs and tables (not the rows). The rows are inside a table paragraph - use the ChildPar reference.

    For example see the wptools code, i.e. procedure TWPCustomRtfEdit.GetSelectedCells(All, Outer: TList); in WPCtrMemo.

  • Thanks. I created this loop and found the table(s). Sorry for bugging again, but I can not find out how to reformat the table to make the frst row recurring on subsequent pages and how to create grey lines between the rows. The examples worked with callbacks on page creation, this I cannot use here.

    Would you mind helping me out and showing how to:

    • using the "par" below make the first row recurring
    • optinally draw lines between the rows

    Thanks in advance

    Code
    par := wp.firstPar;
    while par <> nil do
      begin
        if par.IsTable then begin
           // And now, what's next?
        end;
        par := par.nextPar;
      end; 

    Sorry

  • So finally I nearly got everything how I want it. The last thing I need help with: How do I make the first row of the table the repeating header.?I did not find a WPAT code for that. Would you mind helping me with this? Thanks in Advance!


    P.S. I am aware of the fact, that HTML does not support repeating headers, I was jiust thining that one could use <th> for Headers that are repeated in the document.