Section Support in WPTools

Sections make it possible to use many different header and footer texts and different page sizes in one document. The editor will display an arrow in the left margin where a new section starts.

The following code can be used to create a new section:

var sectionprops : TWPRTFSectionProps;
begin
// New Page
WPRichText1.InputString(#12);
// New section properties
 sectionprops := WPRichText1.ActiveParagraph.StartNewSection;
// Now we can do something with sectionprops
 ...
 end;

Append text from different memos to document

The demo AppendAsSection shows how texts from different editors (WP1,WP2, WP3) can be appended to create one multi section document in the editor WPALL. The 3 buttons use different approaches. The ‘concat strings’ method shows how versatile the “WPTOOLS” format actually is:

procedure TWPALL.AppendWithStringsClick(Sender: TObject);
 begin
 WPAll.AsString := '' + WP1.AsANSIString('WPTOOLS')
 +'' + WP2.AsANSIString('WPTOOLS')
 +'' + WP3.AsANSIString('WPTOOLS');
 // Using no page break will be inserted
 end;

// alternative:
 procedure TWPALL.Append2Click(Sender: TObject);
 begin
 WPAll.HeaderFooter.AppendAsSection(WP1.HeaderFooter);
 WPAll.HeaderFooter.AppendAsSection(WP2.HeaderFooter);
 WPAll.HeaderFooter.AppendAsSection(WP3.HeaderFooter);
 end;