Sidenotes in TRichView Documents

<< Click to display table of contents >>

Sidenotes in TRichView Documents

A sidenote looks like a number (numbering type is specified in TRVStyle.SidenoteNumbering). If FormatString is defined, a number is displayed formatted according to this string.

Sidenote contains a subdocument. This subdocument is not displayed in TCustomRichView where the sidenote is inserted, but it can be printed inside a floating box.

srv_icon ScaleRichView note: TSRichViewEdit displays and allows editing sidenotes.

Class for this item type is TRVSidenoteItemInfo  (see for detailed information).

Style of this item type: rvsSidenote (-206)

The following items are inherited from numbered sidenotes:

text boxes

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

AddItem (create TRVSidenoteItemInfo object, add it using AddItem)

The following method returns TRVSidenoteItemInfo object


Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

InsertItem (create TRVSidenoteItemInfo object, insert it using InsertItem)

The following method returns TRVSidenoteItemInfo object at the position of caret:


The following methods change properties of items as editing operations:






Sidenotes have all properties of numbered sequences.


NumberType is read-only; it always returns TRVStyle.SidenoteNumbering;

SeqName = '@[email protected]' and must not be changed.

Additionally, it has the following properties:

BoxPosition – properties relative to the position of a text box;

BoxProperties – size, border, background, content alignment of a text box.

These properties are also accessible as rveipcFloatHorizontalAnchor, rveipcFloatHorizontalPositionKind, rveipcFloatHorizontalOffset, rveipcFloatHorizontalAlign, rveipcFloatVerticalAnchor, rveipcFloatVerticalPositionKind, rveipcFloatVerticalOffset, rveipcFloatVerticalAlign, rveipcFloatRelativeToCell, rveipcFloatPositionInText, rveipcBoxWidth, rveipcBoxHeight, rveipcBoxWidthType, rveipcBoxHeightType, rveipcBoxBorderColor, rveipcBoxBorderWidth, rveipcBoxBorderInternalWidth, rveipcBoxBorderStyle, rveipcBoxBorderVisibleBorders_Left, rveipcBoxBorderVisibleBorders_Top, rveipcBoxBorderVisibleBorders_Right, rveipcBoxBorderVisibleBorders_Bottom, rveipcBoxBorderBorderOffsets_Left, rveipcBoxBorderBorderOffsets_Top, rveipcBoxBorderBorderOffsets_Right, rveipcBoxBorderBorderOffsets_Bottom, rveipcBoxColor, rveipcBoxPadding_Left, rveipcBoxPadding_Top, rveipcBoxPadding_Right, rveipcBoxPadding_Bottom, rveipcBoxVAlign properties. Accessing them in this way allows changing them in editing operations.

Saving and Loading

Export to HTML

Subdocuments for all sidenotes are saved after the main document. Before each subdocument, <a name="sidenoteN"></a> is inserted, where N is an index of this sidenote (in the list of all numbered sequences and notes). Sidenotes are saved as hyperlinks to this anchor.

RTF and DocX

Sidenotes can be exported in RTF and DocX. They are imported as NoteText followed by a text box containing Document. A bookmark named '_sidenoteN' (where N is an index of this sidenote) is added around NoteText, to allow saving note references as references to this bookmark.

Some combinations of box positioning properties are not supported by Microsoft Word*, so TRichView converts them:

MS Word does not support a vertical alignment relative to a paragraph, so it saved as an alignment relative to a line;

MS Word does not support a relative (percent) positioning to a line or paragraph, so it is saved as an absolute positioning (with zero offset);

Other differences*:

when a line is chosen as an anchor object, MS Word aligns a text box not relative to a whole line but relative to a line top, so a center and a bottom alignment relative to a line are different in TRichView and in MS Word;

MS Word does not implement all options of vertical alignment relative to a table cell, so it works differently in TRichView and MS Word, see BoxPosition.VerticalAnchor;

MS Word does not support different padding for border and background, so BoxProperties.Border.BorderOffsets are not saved to RTF.

(* this information is based on tests of MS Word 2013)

Floating boxes cannot be imported from RTF (yet), but can be imported from DocX. Sidenotes are imported from DocX as text boxes.

In DocX, TRichView supports text boxes both in the old (VML) and the new (DrawingML) formats.


When copying or saving a selected text, sidenotes are not included in text. When saving the whole text, they are saved inside [], for example:

This is a text [a sequence of characters] to show sidenotes [b note of text placed in a floating box].