TSRichViewEdit.Subdocuments

<< Click to display table of contents >>

TSRichViewEdit.Subdocuments

A list of headers and footers.

type
  TSRVSubDocuments = class (TPersistent)
property SubDocuments: TSRVSubDocuments;

The main property of TSRVSubDocuments is Items:

type
  TSRVHeaderFooterType = (
    srvhftFirstPageHeader, srvhftEvenPagesHeader, srvhftNormalHeader,
    srvhftFirstPageFooter, srvhftEvenPagesFooter, srvhftNormalFooter);
  TSRVSubDocumentRVData = class (TCustomRVData)
property Items[Index: TSRVHeaderFooterType]: TSRVSubDocumentRVData;

The Index specifies the header or footer type:

Value

Meaning

Used if...

srvhftFirstPageHeader

Header for the first page

PageProperty.TitlePage=True

srvhftEvenPagesHeader

Header for even pages

PageProperty.FacingPages=True

srvhftNormalHeader

Normal header (for other pages)

Always

srvhftFirstPageFooter

Footer for the first page

PageProperty.TitlePage=True

srvhftEvenPagesFooter

Footer for even pages

PageProperty.FacingPages=True

srvhftNormalFooter

Normal footer (for other pages

Always

Items is the default property, so you can access (for example) the first page header as SRichViewEdit.Subdocuments[srvhftFirstPageHeader].

Headers are shown and used only if PageProperty.HeaderVisible=True. Footers are shown and used only if PageProperty.FooterVisible=True.

Each subdocument is linked to its own TRVStyle object. You can access it as SRichViewEdit.Subdocuments[srvhftFirstPageHeader].GetRVStyle. RichViewEdit.Style is assigned as MainRVStyle to these TRVStyle objects, so they all use a common collection of StyleTemplates.

When an event occurs in some subdocument, RichViewEdit is passed as the Sender parameter of this event.

Editing

When a header is activated for editing (by double clicking or by calling StartEditing), a document is loaded in RVHeader. When a footer is activated for editing, a document is loaded in RVFooter. An edited document is saved back to Subdocuments when the editing is finished, or when the main document needs to be saved or printed. The process of saving and loading data between Subdocuments and RVHeader/RVFooter is completely automatic and transparent for the user.

Saving to files

Headers and footers can be saved in RVF, RTF, DocX files, loaded from RVF, RTF files.

PageProperty.TitlePage and FacingPages only turn on/off displaying of the specific headers and footers. They do not affect saving and loading: all headers and footers are stored.

Assigning PageProperty.HeaderVisible=False prevents saving and loading headers.

Assigning PageProperty.FooterVisible=False prevents saving and loading footers.