Page 1 of 1

detect and enumerate notes?

Posted: Sun Feb 09, 2014 12:25 am
by Jim Knopf
Which way is the best to enumerate notes and to detect if a text has notes?

My application consists of a lot oft textfiles, listed in a treeview. I need a list, in which text are notes, how many and with which content. I could not find an easy way for this problem. Can you give me a hint please?

Posted: Sun Feb 09, 2014 5:39 am
by mohsen24000
uses CRVData;

var
itemno: integer;
NoteText: String;
begin
...
for ItemNo := 0 to RV.ItemCount - 1 do
if RV.GetItem(ItemNo) is TCustomRVNoteItemInfo then
begin
NoteText := GetRVDataText(TCustomRVNoteItemInfo(RV.GetItem(ItemNo)).Document);
end;
...
end;

Posted: Sun Feb 09, 2014 1:36 pm
by Jim Knopf
Thanks a lot, works fine!

Posted: Mon Feb 10, 2014 10:34 am
by Sergey Tkachenko
This code work only for notes outside table cells. I complete enumeration procedure should also call similar code for each table cell recursively.

But for notes, there is a simpler and faster solution:
http://www.trichview.com/help/idh_fun_r ... dnote.html
The most universal function is not listed there. It is
function GetNextNote(RVData: TCustomRVData; Note: TCustomRVNoteItemInfo;
NoteClass: TCustomRVNoteItemInfoClass; AllowHidden: Boolean): TCustomRVNoteItemInfo;

Code: Select all

Note: TCustomRVNoteItemInfo;

Note := GetNextNote(RV.RVData, nil, TCustomRVNoteItemInfo, True);
while Note<>nil do begin
  NoteText := GetRVDataText(Note.Document); 
  ...
  Note := GetNextNote(RV.RVData, Note, TCustomRVNoteItemInfo, True);
end;
PS: in the new version (available for registered users) two new types of items will be listed (in addition to foonotes and endnotes): sidenotes and textbox items.

Posted: Wed Feb 12, 2014 5:46 am
by mohsen24000
As always Thanks a lot :D

Re: detect and enumerate notes?

Posted: Fri Dec 21, 2018 11:33 am
by mohsen24000
Hi again
How can change text style of a note text !?
for example change color of number of footnotes( note text)

Re: detect and enumerate notes?

Posted: Fri Dec 21, 2018 12:30 pm
by Sergey Tkachenko
Do you want to change color of number of footnotes inserted by RichViewActions (TrvActionInsertFootnote for TRichViewEdit, or TsrvActionInsertFootnote for ScaleRichView)? It is only possible if you use StyleTemplates. In this case, you need to define properties of the style template named 'footnote reference'.
In the style dialog (Format | Styles), if UI is English, you can see this style as "Footnote Reference (Standard)". Click "Edit" next to font properties of this style, and define color. If this style is not defined, you can add it in this dialog (button "Add", "Standard style").
If you want to define this style for new documents, add it in to StyleTemplates property of TrvActionNew at design time (it must be named exactly as 'footnote reference', case sensitive).

Or maybe you insert it without RichViewActions? Or do you want to change text of a note number that was already inserted?

Re: detect and enumerate notes?

Posted: Fri Dec 21, 2018 12:51 pm
by Sergey Tkachenko
For endnotes and sidenotes, the solution is the same, the styles have names "endnote reference" and "Sidenote Reference".
You can also define properties of text in their documents, the styles have names "footnote text", "endnote text", "Sidenote Text".

Re: detect and enumerate notes?

Posted: Fri Dec 21, 2018 7:59 pm
by mohsen24000
Sergey Tkachenko wrote: Fri Dec 21, 2018 12:30 pm Or maybe you insert it without RichViewActions? Or do you want to change text of a note number that was already inserted?
yes, I want to change color or font of a note number that was already inserted.
when i select context that contain a footnote number and use ApplyTextStyle, footnote number (note text) style change to current style
This text contains <sup>1</sup> text => This text contains 1 text.