Create index of document

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
prosoft
Posts: 24
Joined: Tue Jul 11, 2006 8:51 am

Create index of document

Post by prosoft » Mon Oct 20, 2008 6:11 am

Is any chance to create index of RVF document witch page number marks where is inserted on top of RVF document? (like as MS WORD). I am using list styles with levels and i would like to use them for creating index of document.

Thaks. Josef.

Sergey Tkachenko
Site Admin
Posts: 14645
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Tue Oct 21, 2008 1:25 pm

This functionality is not supported.
I can explain how it's possible to implement it.
You need to build a table of contents/index yourself. To do it, you need to know page number where the specified item located.
If you want to insert TOC/index at the beginning, you must take into account that they will occupy one or more pages too, so you need to add this number of pages to get the resulting values.

So, you have some item and know its ItemNo (index in the document, from 0 to SRichViewEdit.RichViewEdit.ItemCount-1). How to get its page? Unfortunately, ScaleRichView does not have methods returing a page number by an ItemNo. But it has methods working with DrawItemNo (index of "drawing item"):

Code: Select all

// DrawItemNo --> page number
getRVPageNoEx(DrawItemNo : Integer): Integer
// Page number --> the first DrawItemNo on page
getPageStartDrawItemNo(PageNo : Integer) : Integer
You can convert ItemNo to DrawItemNo using
SRichViewEdit.RichViewEdit.RVData.Item2FirstDrawItem(ItemNo, DrawItemNo). Document must be formatted, otherwise this method fails.

Post Reply