Page 1 of 1

LoadRVFFromStream & ScaleRichView\Demos\ActionTestTabsRi

Posted: Mon Dec 03, 2012 8:25 am
by Camphausen
Hi Sergey and Ilya,
can you please provide some help how to properly load RVF from stream using your editor (RVARibbonFrm.pas) - which is a fantastic piece of code!!!! :D

I use code like this:
if LoadDocToStream(blob_ID, stream,DocMargins) then
if ActiveEditor.LoadRVFFromStream(stream) then begin
if bMargins then
with ActiveEditor do begin
PageProperty.LeftMargin:=DocMargins.LeftMarginMM;
PageProperty.RightMargin:=DocMargins.RightMarginMM;
PageProperty.BottomMargin:=DocMargins.BottomMarginMM;
PageProperty.TopMargin:=DocMargins.TopMarginMM;
end;
ActiveEditor.RichViewEdit.ReadOnly := Not lDP.CanEdit;
Ribbon1.HideTabs := Not lDP.CanEdit;
ActiveEditor.RichViewEdit.Modified:=false;


I have 2 problems and an extra question:
1) I still have some old RVFs in my database with page margins stored separately (in mm). How do I apply these margins to my document? I have seen http://www.trichview.com/forums/viewtopic.php?t=5404 but find it hard to understand.

2) How can I update SRVPageScroll1? AutoUpdate=true, however, the new thumbnails appear on top of the old ones - eventually producing a messy, almost black thumbnail after opening several documents one after the other.

3) does SRVE provide an options to freely place a textbox or (scaled) image on top (or behind) the text ?

Thanks for your help.
Keep up the great work!
Kind regards
Christoph

Posted: Mon Dec 03, 2012 10:23 am
by Sergey Tkachenko
Do you want to keep a multidocumental interface?

This demo has a multidocument tabbed interface, and it assumes that documents are stored in files. Information about opened files is maintained in rvActionSave1. It returns properties of document for the given editor as rvActionSave1.FindDoc.

If you want to store documents elsewhere, you:
1) cannot use TrvActionSave, SaveAs, Open, New - they are linked to files. Implement similar commands yourself.
2) Implement analogs of rvActionSave1.FindDoc and CanCloseDoc, and Form.GetDocInfo method, rvActionSave1DocumentFileChange.

Before calling your code for loading from a stream, call AddEditor (except for the initial document in the first tab: the first editor is created at design time).
After loading, call UpdateIcon.

As for your code:
1) ActiveEditor.Format must be called at the end.
2) Use ActiveEditor.RichViewEdit.LoadRVFFromStream instead of ActiveEditor.LoadRVFFromStream. The latter formats a document, but you need to format it again after changing margins.