RVF-parser ...?

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

RVF-parser ...?

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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).
Post Reply