problem [urgent]

General TRichView support forum. Please post your questions here
Post Reply
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

problem [urgent]

Post by Ceprotec »

Hello Sergey,
I have a serious problem, this is my original text:
Image

I save the text above in the database, but when you open it is cut:
Image

I record in a table, where the field is type "image":
Image

but it is not always what happens, see the code that opens the document:

Code: Select all

            Stream := Query.CreateBlobStream(QueryMODELO,bmRead);
            SRichViewEdit1.RVHeader.Clear;
            SRichViewEdit1.RVFooter.Clear;
            SRichViewEdit1.RichViewEdit.Clear;
            SRichViewEdit1.RichViewEdit.LoadRVFFromStream(Stream);
            Stream.Free;
            SRichViewEdit1.RVHeader.Format;
            SRichViewEdit1.RVFooter.Format;
            SRichViewEdit1.SetRVMargins;
            FillFields(SRichViewEdit1.RichViewEdit.RVData); ///corpo do texto
            SRichViewEdit1.RichViewEdit.Format;
            FillFields(SRichViewEdit1.RVHeader.RVData); ///cabeçalho
            SRichViewEdit1.RVHeader.Format;
            FillFields(SRichViewEdit1.RVFooter.RVData); ///rodape
            SRichViewEdit1.RVFooter.Format;
what might be happening?

thanks.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

this is the code to save the database:

Code: Select all

QueryImpressos.Close;
QueryImpressos.Open;
QueryImpressos.UpdateObject := UpdateSQL1;
QueryImpressos.CachedUpdates := true;
QueryImpressos.Insert;
QueryImpressosTIPO.AsInteger := tipo.ItemIndex;
QueryImpressosDESCRICAO.AsString := descricao.Text;
QueryImpressosTIPO_ES.AsString := tipo.Text;
QueryImpressosFolhaInicial.AsString := QueryBuscaDadosFolhaInicial_liv.AsString
QueryImpressosFolhaFinal.AsString := QueryBuscaDadosFolhaFV.AsString;
QueryImpressosTermo.AsInteger := QueryBuscaDadosTermoFinal_liv.AsInteger;
QueryImpressosLivro.AsInteger := QueryBuscaDadosNumeroLivro_liv.AsInteger;
QueryImpressosCodigoEscritura.AsInteger := QueryTransCODIGO.AsInteger;

SRichViewEdit1.RVFOptions := SRichViewEdit1.RVFOptions - [rvfoSavePicturesBody];
SRichViewEdit1.RVHeader.RVFOptions := SRichViewEdit1.RVHeader.RVFOptions - [rvfoSavePicturesBody]; 
Stream := QueryImpressos.CreateBlobStream(QueryImpressosMODELO,bmWrite);
SRichViewEdit1.RichViewEdit.SaveRVFToStream(Stream,False);
Stream.Free;
QueryImpressos.Post;
QueryImpressos.ApplyUpdates;
QueryImpressos.CommitUpdates;
QueryImpressos.Close;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please save this document in a file and send to richview gmail com
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

file sent, thank you.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I received your files.
The problem is not in loading, because the both your files end on "Pelos representantes legais da outorgad".
So the problem may be in saving. Please save the original document, containing the full text.

PS: there are potential problems in this code, however, they do not affect this bug:
1) before saving, the existing content of the stream must be cleared.
2) instead of

Code: Select all

           SRichViewEdit1.RVHeader.Clear; 
            SRichViewEdit1.RVFooter.Clear; 
            SRichViewEdit1.RichViewEdit.Clear; 
            SRichViewEdit1.RichViewEdit.LoadRVFFromStream(Stream); 
            Stream.Free; 
            SRichViewEdit1.RVHeader.Format; 
            SRichViewEdit1.RVFooter.Format; 
            SRichViewEdit1.SetRVMargins;

the code must be:

Code: Select all

            SRichViewEdit1.Clear; 
            SRichViewEdit1.RichViewEdit.LoadRVFFromStream(Stream); 
            Stream.Free; 
            SRichViewEdit1.Format;
3) If you use ScaleRichView 6 or newer, you need to apply FillFields to all SRichViewEdit1.SubDocuments[] instead of RVHeader and RVFooter.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

this code is to load the file, but and save, correct?
I will send the original file by email.
Post Reply