WPCubed GmbH
Wordprocessing and PDF components 

Section Support in WPTools

Sections allow for the use of various header and footer texts, as well as different page sizes within a single document. The editor will show an arrow in the left margin to indicate where a new section begins.

 

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;

 ;