Top  Previous  Next


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 clip0112 in the left margin where a new section starts.


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


var sectionprops : TWPRTFSectionProps;


// New Page


// New section properties

 sectionprops := WPRichText1.ActiveParagraph.StartNewSection;

// Now we can do something with sectionprops




Each section is defined by an instance of TWPRTFSectionProps. The property WPRichText.Header which stores the default page size for the whole document is consequently implemented using a class which inherits from TWPRTFSectionProps.


Usually all instances of TWPRTFSectionProps use the property value defined in the master section property (WPRichText.Header). If certain attribute should be unique for a section the property Selected must be set accordingly.


 sectionprops.Select := [wpsec_PageSize];

 sectionprops.Landscape := TRUE;


The following flags exist in property Select:

   wpsec_PageSize        --> Overwrite PageWidth, PageHeight and Landscape

   wpsec_Margins        --> Top, left and other margins

   wpsec_TabDefault        --> Change deftabstop property

   wpsec_PageMirror        --> change the marginmirror property


Note: The "speed reformat" feature of WPTools Version 9 does not work well with different page sizes yet. So please switch this feature off using WPAll.FormatOptions := [wpDisableSpeedReformat];


It is also possible to select that certain header or footer texts should be only used for one section. This is done by the property TWPRTFDDataBlock.UsedForSectionID. If this property is changed to sectionprops.SectionID the text block will be only used for that special section.


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 3 different approaches:


1.) Full implementation - shows how to work with sections

2.) Use utility procedure AppendAsSection - same functionality as 1)

3.) Use strings in WPTOOLS format with the <newsection/> tag.





4) Append section with individual footer (or header)