Page 1 of 1

Appending from a RVF into ScaleRichView

Posted: Sun Nov 25, 2018 12:42 pm
by pgkammath
Hi,
I could not find an answer in the forum, hence the question. Pardon me if this is silly, since I am short on time for the project.

I want to append an RVF file at the end of my current ScalerichView file, (I modified the the Actiontest from the demo from scalerichview) .
I use the following code for that.

In the file 1664.rvf, the data is Right Aligned, but when it is appended, it becomes left aligned. I am bit confused on accessing the parastyles etc in scalerichview.

First I load into a RichViewEdit, then to the Actual Editor, is there any other way where i can directly append this file.

var Stream: TMemoryStream;
cFile : String;
begin
cFile := '\\bmh-doc\RADIOLOGY\SIGNATURES\1664.rvf'; // This part is dynamic . I added for a reference

RichViewEdit1.Clear;
RichViewEdit1.LoadRVF(cFile);
RichViewEdit1.Format;

Stream := TMemoryStream.Create;
try
RichViewEdit1.SaveRVFToStream(Stream, False);

Stream.Position := 0;

// This is the scalerichview Editor
TextEdit.RichViewEdit.AppendRVFFromStream(Stream,0);
TextEdit.Format;
finally
Stream.Free;
end;

Please help,
thanks in advance.

Re: Appending from a RVF into ScaleRichView

Posted: Sun Nov 25, 2018 6:44 pm
by Sergey Tkachenko
Use InsertRVFFromStream instead of AppendRVFFromStream:

Code: Select all

TextEdit.RichViewEdit.InsertRVFFromStream(Stream, TextEdit.RichViewEdit.ItemCount);
AppendRVFFromStream is useful if you want to override a paragraph style of the first paragraph of the inserted content.
When you call TextEdit.RichViewEdit.AppendRVFFromStream(Stream, 0), the first inserted paragraph is formatted using TextEdit.RichViewEdit.Style.ParaStyles[0]