[Unit] Item for saving a table of contents in RTF and DocX
Posted: Mon Oct 05, 2015 8:56 am
Update 2018-Apr-18: the link is removed because this unit is included in the TRichView setup:
<TRichView Dir>\TRichView\Source\RVTOCItem.pas
This file contains RVTocItem.pas unit, implementing a new item type: a table of contents for exporting in RTF and DocX files.
When inserting in our editors, it looks like {TOC}.
When exporting to RTF or DocX, it looks like [Update fields to build a table of contents]. When the user right click this text in Microsoft Word and chooses "Update Field" from the context menu, Microsoft Word inserts a table of contents in its place (providing that this document has headings).
This item has property: MaxLevel, a maximal level of headings used to build TOC (counted from 1). This property can be accessed with GetExtraItemIntPropertyEx and related method as rveipcMaxLevel. For example,changes value of this property as an editing (undoable) operation for a TOC at the caret position.
This property also can be defined in constructor:
See also:
http://www.trichview.com/forums/viewtop ... 702#p34702 - overview of TOC solutions for TRichView and ScaleRichView
<TRichView Dir>\TRichView\Source\RVTOCItem.pas
This file contains RVTocItem.pas unit, implementing a new item type: a table of contents for exporting in RTF and DocX files.
When inserting in our editors, it looks like {TOC}.
When exporting to RTF or DocX, it looks like [Update fields to build a table of contents]. When the user right click this text in Microsoft Word and chooses "Update Field" from the context menu, Microsoft Word inserts a table of contents in its place (providing that this document has headings).
This item has property: MaxLevel, a maximal level of headings used to build TOC (counted from 1). This property can be accessed with GetExtraItemIntPropertyEx and related method as rveipcMaxLevel. For example,
Code: Select all
RichViewEdit1.SetCurrentItemExtraIntPropertyEx(rveipcMaxLevel, 4, True);
This property also can be defined in constructor:
Code: Select all
var TOC: TRVTOCItemInfo;
begin
TOC := TRVTOCItemInfo.CreateEx(RichViewEdit1.RVData, 3);
RichViewEdit1.InsertItem('', TOC);
end;
http://www.trichview.com/forums/viewtop ... 702#p34702 - overview of TOC solutions for TRichView and ScaleRichView