Issue with ActionTest Tabs wiht LoadFromStream

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
resilux
Posts: 17
Joined: Tue Apr 27, 2010 2:06 pm

Issue with ActionTest Tabs wiht LoadFromStream

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

Post by Sergey Tkachenko »

Property settings are important.
Can you create a simple test project and send to richviewgmailcom?
resilux
Posts: 17
Joined: Tue Apr 27, 2010 2:06 pm

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

Post 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.
resilux
Posts: 17
Joined: Tue Apr 27, 2010 2:06 pm

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

Post 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; 
resilux
Posts: 17
Joined: Tue Apr 27, 2010 2:06 pm

Post by resilux »

Thanks Sergey

It is working.

Regards
Post Reply