Page 1 of 1

problem [urgent]

Posted: Tue Mar 24, 2015 2:12 pm
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.

Posted: Tue Mar 24, 2015 2:17 pm
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;

Posted: Wed Mar 25, 2015 7:18 am
by Sergey Tkachenko
Please save this document in a file and send to richview gmail com

Posted: Wed Mar 25, 2015 11:26 am
by Ceprotec
file sent, thank you.

Posted: Wed Mar 25, 2015 11:46 am
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.

Posted: Wed Mar 25, 2015 1:04 pm
by Ceprotec
this code is to load the file, but and save, correct?
I will send the original file by email.