<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