Reading RTF metadata Title DIRECTLY from RTF file?

General TRichView support forum. Please post your questions here
Post Reply
PeterPanino
Posts: 57
Joined: Tue Jul 13, 2010 10:50 pm

Reading RTF metadata Title DIRECTLY from RTF file?

Post by PeterPanino »

Hi! Is there a *FAST* method to read the metadata Title from an RTF file (previously saved with RichViewEdit TRVDocParameters.Title), without having to load the whole RTF file into a RichView object?
Sergey Tkachenko
Site Admin
Posts: 17287
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, no, you need to load RTF.
PeterPanino
Posts: 57
Joined: Tue Jul 13, 2010 10:50 pm

Post by PeterPanino »

I need to use a FAST method because I have to fill a list with the metadata. I have seen that the metadata are always in the first line of the RTF file and start with '{\author ' and '{\title ' etc. So I now read the first line of the RTF file and parse it for these strings, which seems to work well.

Is this true? Can I be sure that the metadata are always in the first line and always start with the above mentioned strings? The RTF files I need to read in have always been previously created with RichViewEdit.
Sergey Tkachenko
Site Admin
Posts: 17287
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Well, while there is no standard saying that these data must be at the beginning of RTF file, they are usually written at the beginning. Yes, TRichViewEdit writes them at the first line, but if you read documents created by other editors, you cannot rely on this.

If you want to extract them yourself, please test how they are saved if strings contain non-English characters.
PeterPanino
Posts: 57
Joined: Tue Jul 13, 2010 10:50 pm

Post by PeterPanino »

Sergey Tkachenko wrote:Yes, TRichViewEdit writes them at the first line,
So PLEASE keep this in the future, or my program will be broken all over the world!
Sergey Tkachenko wrote:If you want to extract them yourself, please test how they are saved if strings contain non-English characters.
German Umlaut and Unicode characters do work well, no problem here.

I've also discovered the "\upr" keyword which points to the Unicode representation of the string.

Are there other special RTF keywords used by RichView when saving the Author, Title and Comments metadata?
Sergey Tkachenko
Site Admin
Posts: 17287
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Well, there is no reason for adding line breaks there.

No, there should be no other special keywords.
Post Reply