Page 1 of 1
Reading RTF metadata Title DIRECTLY from RTF file?
Posted: Sun Dec 16, 2012 6:10 pm
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?
Posted: Mon Dec 17, 2012 8:50 am
by Sergey Tkachenko
Sorry, no, you need to load RTF.
Posted: Mon Dec 17, 2012 10:15 am
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.
Posted: Tue Dec 18, 2012 1:14 pm
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.
Posted: Thu Dec 20, 2012 11:43 pm
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?
Posted: Fri Dec 21, 2012 7:11 am
by Sergey Tkachenko
Well, there is no reason for adding line breaks there.
No, there should be no other special keywords.