Create Sections with FastAppendText

<< Click to Display Table of Contents >>

Navigation:  Programming > Create text under program control > FastAppendText: Create text with multiple letters >

Create Sections with FastAppendText

The above code simply copies the text to the destination. It will be one large text without sections.

To create sections please add the marked lines in red. We use the section property wpsec_ResetOutlineNums to make sure each section uses its own outline numbering.

 

  var Section : TWPRTFSectionProps;

 

  try

  Table1.First;

...

        // Need page break

        Section := AllRTFText.FastAppendText(WPRichText1,true, [wpCreateNewPage]);

        Section.Select := [wpsec_ResetOutlineNums, wpsec_ResetPageNumber];

    end;

...

  end;

  finally

...

  end;