Page 1 of 1
RVF-parser ...?
Posted: Tue Jan 20, 2015 10:02 pm
by Jim Knopf
I used TRVRTFReader to extract plain text in a fast way from rtf files.
Now I had to convert the whole system to rvf files.
Is there a similar way to get the whole file content as plain text as easy?
Posted: Wed Jan 21, 2015 11:52 am
by Sergey Tkachenko
Only by loading in TRichView and saving as a plain text.
If a document does not contain tables, reading a plain text from RVF without TRichView can be implemented very simple. But tables are saved using the Delphi component streaming mechanism, and parsing may be quite complicated.
Posted: Wed Jan 21, 2015 2:39 pm
by Jim Knopf
Sergey Tkachenko wrote:If a document does not contain tables, reading a plain text from RVF without TRichView can be implemented very simple.
No Tables.
I load the rvf file into a temporary RVEdit, iterate all the items and extract the text by rv.GetItemText(i). I thought there would be a built-in method for that.
Posted: Wed Jan 21, 2015 4:55 pm
by Sergey Tkachenko
RVF specification is here:
http://www.trichview.com/help/rvf_specification.html
RVF consists of records.
Each record has a header line. Each header line starts from several numbers separated by space characters.
You need records starting from zero or positive number, they represent text. The second number is the number of text lines in this record.
You need to skip the rest of records. The second number in the record is the number of lines to skip. A special case: the fifth number equal to 2. In this case, the last line in this record is not a text line but binary data. Binary data starts from its size (4bytes).