Appending from a RVF into ScaleRichView

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

Appending from a RVF into ScaleRichView

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

Re: Appending from a RVF into ScaleRichView

Post 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]
Post Reply