detect and enumerate notes?

General TRichView support forum. Please post your questions here
Post Reply
Jim Knopf
Posts: 172
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

detect and enumerate notes?

Post by Jim Knopf » Sun Feb 09, 2014 12:25 am

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?

mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 » Sun Feb 09, 2014 5:39 am

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;

Jim Knopf
Posts: 172
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf » Sun Feb 09, 2014 1:36 pm

Thanks a lot, works fine!

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

Post by Sergey Tkachenko » Mon Feb 10, 2014 10:34 am

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.

mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 » Wed Feb 12, 2014 5:46 am

As always Thanks a lot :D

mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Re: detect and enumerate notes?

Post by mohsen24000 » Fri Dec 21, 2018 11:33 am

Hi again
How can change text style of a note text !?
for example change color of number of footnotes( note text)

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

Re: detect and enumerate notes?

Post by Sergey Tkachenko » Fri Dec 21, 2018 12:30 pm

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?

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

Re: detect and enumerate notes?

Post by Sergey Tkachenko » Fri Dec 21, 2018 12:51 pm

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".

mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Re: detect and enumerate notes?

Post by mohsen24000 » Fri Dec 21, 2018 7:59 pm

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.

Post Reply