TSRichViewEdit control contains several TRichViewEdit controls inside. These controls are invisible, they are used to render end edit different document parts. These controls are available as properties of TSRichViewEdit:
•RichViewEdit for the main document;
•RVHeader for page headers;
•RVFooter for page footers;
•RVNote for notes and text box items.
RichViewEdit stores the main document. Other editors are used to edit documents stored in different places:
•RVNote edits Document of footnotes, endnotes, sidenotes, text boxes.
When you load a new document, call TSRichViewEdit.Format.
This method copies page properties from TSRichViewEdit.RichViewEdit.DocParameters to TSRichViewEdit.PageProperty (when loading files, page properties are loaded in RichViewEdit.DocParameters), formats RVHeader, RVFooter, RichViewEdit, notes and text boxes, paginates the document.
Example of loading RTF file:
The same sequence must be called for other loading methods of TSRichViewEdit.RichViewEdit: LoadRTFFromStream, LoadRVF, LoadRVFFromStream, LoadText, etc.
If you do not want to display a header and a footer, assign:
The active TRichViewEdit control (the control corresponding to the document part containing the caret) is returned in the TSRichViewEdit.ActiveEditor property.
To activate editing of the main document, a header, or a footer, call StartEditing.
To activate editing of a footnote or an endnote, call StartEditNote.
The user can activate editing of the page header/footer by double clicking.
If you use RichViewActions, you can use the following actions to switch between document parts:
TsrvActionEditHeader starts editing a page header;
TsrvActionEditFooter starts editing a page footer;
TsrvActionEditMain to return to the main document.
All editing operations must be applied to ActiveEditor, for example:
ChangeStyleTemplates must not be called for ActiveEditor. It must not be called if ActiveEditor=RVNote.
Operations applied to the whole document (such as saving or loading) must be called for the main editor:
In the events of TSRichViewEdit (such as OnStyleConversion, OnParaStyleConversion, OnCurTextStyleChanged, OnCurParaStyleChanged) you can distinguish the TRichViewEdit control using the Sender parameter.