WPCubed Product Support

Extra CR at top of merges after the first [ignore prev]

Please ignore my previous post. This one has better information.

I turned on visibility of CR, NL, FF etc. in the previewer.

My merge document template is 2 pages, and in my test case, I have 4 items, which in WP4 produced a total of 8 pages. The merge document template begins and ends with a CR. In WP6, an extra CR is being added at the top of items 2, 3, and 4. I don't see why. Does inputString(#12) add a paragraph as well as a formfeed? Here is the code:

firsttime := true;
    rtftemplate.InsertPointAttr.Hidden := true;
    rtfmerged.ClearBody;
    rtfMerged.Header.Assign(rtfTemplate.Header);

    for i:=0 to CertObjects.Count-1 do begin
        rtfTemplate.MergeText;   

        if firsttime then begin
          firsttime := false;
          rtfMerged.AsString := rtfTemplate.AsString;
        end
        else begin
          rtfMerged.CPPosition := MaxInt; 
          rtfMerged.InputString(#12);     //new page. jhg 02/24/2011
          rtfmerged.FastAppendText(rtftemplate);
        end;
    end;
#1 ♥ 0
4.8k Views 1 links 2 users read 2 min

I think I have the answer. There is an enumerated type wpCreateNewPage, not documented, but used in an example on p40 of WPToolsManual.pdf. There is one post auf Deutsch last november, but otherwise this little baby is hidden.

Replace the following ..

rtfMerged.CPPosition := MaxInt;           rtfMerged.InputString(#12);     //new page. jhg 02/24/2011           rtfmerged.FastAppendText(rtftemplate);

With ..

rtfmerged.FastAppendText(rtftemplate,True,[wpCreateNewPage]);
#2 ♥ 0
support

Hi,

Thank You for the perfect suggestion. (I know, there are things which are not documented, but I try to make the options use a name which explains what they are used for.)

This is the link to the manual:
[](http://www.wpcubed.com/manuals/wptools5/IDH_TWPCustomRtfEdit_FastAppendText.htm)

wpCreateNewPage - creates a new page
wpReuseLastPar - will use the last paragraph if is empty.
wpCombineTableIfPossible - if the text starts with a table the code moves the rows at the end of the previous table.

#3 ♥ 0

Is it true that inputstring(#12) creates a blank line? This seems very odd, and I wonder why many other developers haven't reported issues with it.

#4 ♥ 0
support

Hi,

inputstring(#12) insers a line break, that is true. (It has to)

The "wpReuseLastPar" flag is intended to use the create line in such a case when the text is appended.

If you want to create a pagebrek before a certain paragraphs use
ActiveParagraph.IsNewPage := true

Julian

#5 ♥ 0
This category is archived. No new posts are possible.