Page 1 of 1

Issue with ActionTest Tabs wiht LoadFromStream

Posted: Tue Apr 08, 2014 2:45 pm
by resilux
Hello

I am using your demo ActionTest tabs as a editor. I store the documents in a database. I have noticed a problem since I have updated my components to XE 5 and to the latest versiĆ³n of RichView. The problema is the following. I have a blank document, I write something, or include a table, perfect. Then I save the document in the database. When I load the stored document, the layout is the same, but if you try to indent a paragraph, then the text is move to the right a lot of positions. If I try to insert a table then this table have 1500 pt as cell padding and cell spacing. So I think that when I upload the document something is missing or wrong and measurements are not the same anymore.

This is the code I use to save and load documents :

1) Saving

SRichViewEdit1.RichViewEdit.Modified := False;
FDataStream.Clear;
FDataStream.Position := 0;
if FSaveRVF_RTF = 0 then
SRichViewEdit1.RichViewEdit.SaveRVFToStream( FDataStream,False )
else
if FSaveRVF_RTF = 1 then
SRichViewEdit1.RichViewEdit.SaveRTFToStream( FDataStream,False );

2) Loading

WasSaved := False;

FDataStream.Position := 0;
SRichViewEdit1.RichViewEdit.LoadFromStream(FDataStream,rvynaAuto);
FDataStream.clear;

SRichViewEdit1.RVHeader.Format;
SRichViewEdit1.RVFooter.Format;
SRichViewEdit1.SetRVMargins(True);
SRichViewEdit1.Format;

Can you help me ?

Regards

Jesus Mendez

Posted: Tue Apr 08, 2014 2:56 pm
by Sergey Tkachenko
Property settings are important.
Can you create a simple test project and send to richviewgmailcom?

Posted: Wed Apr 09, 2014 6:48 am
by resilux
Hi Sergey

I do not know how to do it. I store the documents in SQL Anywhere. What I can send you is the two units I use, that are in fact your demo of Action Test Tab and then you can call the unit passing the stream.

First time when you open the editor is always fine. Once you close the Editor (even without saving nothing) then if you try ton indent a paragraph or insert a table then happens weird things.

Please take a look you mail, I will send you this two files.

Regards

Posted: Wed Apr 09, 2014 11:07 am
by Sergey Tkachenko
I think it happens because RVA_ConvertToTwips is called multiple times for the same datamodule or form.
It must be called only once, if you want to measure actions in twips instead of pixels.

Posted: Wed Apr 09, 2014 2:02 pm
by resilux
Hi Sergey

In fact this is the problem. But I only call to this procedure once in Editform in formcreate event.

How is that possible if I create the editform and after that I destroy it, that this affects twice.

RVA_ConvertToTwips(srvActionsResource); >>>>>> this one
RVAControlPanel1.UnitsProgram := rvstuTwips;
SRichViewEdit1.ConvertToTwips;
cmbUnits.ItemIndex := ord(SRichViewEdit1.UnitsProgram);
RVAControlPanel1.UnitsDisplay := SRichViewEdit1.UnitsProgram;

Regards

Posted: Wed Apr 09, 2014 4:07 pm
by Sergey Tkachenko
It happens because the actions not on the form, but on a datamodule.
I suggest to move RVAControlPanel1 from this form to this datamodule, and move this code to FormCreate of this datamodule:

Code: Select all

RVA_ConvertToTwips(Self);
RVAControlPanel1.UnitsProgram := rvstuTwips; 

Posted: Thu Apr 10, 2014 6:50 am
by resilux
Thanks Sergey

It is working.

Regards