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:
Append text...
(please click to enlarge)
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;
"WPTools offers us the power and control of a word processor in the form of a regular Delphi component. ... It is clear that the author has spend a lot of time making sure the class hierachy is the best it can be both from a usability and performance perspective. ... If you need both GUI and code-level control over your documents, WPTools is the answer" - Craig Murphy in Delphi Magazine, February 2005 Page 46-51
"Just on a side note, thanks for the recent help support, its been great. My experience with your components just gets better and better and better. There just bloody awesome" - Grant Brown 2/13/06