Reading RTF metadata Title DIRECTLY from RTF file?
-
- Posts: 57
- Joined: Tue Jul 13, 2010 10:50 pm
Reading RTF metadata Title DIRECTLY from RTF file?
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?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 57
- Joined: Tue Jul 13, 2010 10:50 pm
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.
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.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
If you want to extract them yourself, please test how they are saved if strings contain non-English characters.
-
- Posts: 57
- Joined: Tue Jul 13, 2010 10:50 pm
So PLEASE keep this in the future, or my program will be broken all over the world!Sergey Tkachenko wrote:Yes, TRichViewEdit writes them at the first line,
German Umlaut and Unicode characters do work well, no problem here.Sergey Tkachenko wrote:If you want to extract them yourself, please test how they are saved if strings contain non-English characters.
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?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: