Page 1 of 1

TRVReportHelper problems

Posted: Thu Nov 24, 2005 12:16 am
by lommez
Im trying to paint the document in a TPaintBox canvas but im not having success.

When loading the document from stream to the ReportHelper generates an exception.

Take a look at my code:

procedure TForm1.Button1Click(Sender: TObject);
var
CWidth: Integer;
MS: TMemoryStream;
const
VERYLARGEVALUE = $FFFFFFF;
begin
try
MS := TMemoryStream.Create;
RichViewEdit1.SaveRVFToStream(MS, False);
MS.Position := 0;
RVReportHelper1.RichView.LoadRVFFromStream(MS); // Here is the exception
finally
MS.Free;
end;
CWidth :=
RichViewEdit1.RVData.DocumentWidth +
RichViewEdit1.LeftMargin+RichViewEdit1.RightMargin;
RVReportHelper1.Init(PaintBox1.Canvas, CWidth);
while RVReportHelper1.FormatNextPage(VERYLARGEVALUE) do;
PaintBox1.Width := CWidth;
PaintBox1.Height := RVReportHelper1.EndAt;
RVReportHelper1.DrawPage(1,PaintBox1.Canvas,True,RVReportHelper1.EndAt);
end;

Posted: Thu Nov 24, 2005 9:24 am
by Sergey Tkachenko
Add

Code: Select all

RVReportHelper1.RichView.Style := <some RVStyle component>;
RVReportHelper1.RichView.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
RVReportHelper1.RichView.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;

Posted: Tue Oct 21, 2008 11:44 pm
by Marsianin
I have another problem with it when loading RVF from stream. Here is the code:

Code: Select all

RVReportHelper1.RichView.Clear;
try
  Stream:=TMemoryStream.Create;
  RichViewEdit1.SaveRVFToStream(Stream,False);
  Stream.Position:=0;
  RVReportHelper1.RichView.LoadRVFFromStream(Stream);
finally
  RVReportHelper1.RichView.Format;
  Stream.Free;
end;
RVStyle is connected and rvrsAddIfNeeded are set. It loads document correctly if that has no URL's inside. But when it founds a link - it raises exception:
http://www.allapp.com is not an Integer value
for each link :shock:

Posted: Wed Oct 22, 2008 3:35 pm
by Sergey Tkachenko
Include rvoTagsArePChars in RVReportHelper1.RichView.Options.

Posted: Wed Oct 22, 2008 7:42 pm
by Marsianin
Oops, sorry, I knew it :)
But now exception raises in RVReportHelper1.RichView.Format; :shock:

Add: But it works fine without Format routine.

Posted: Thu Oct 23, 2008 8:33 am
by Sergey Tkachenko
Yes, please never call TRVReportHelper.RichView.Format. It makes no sense and can raise an exception. Use TRVReportHelper.Init for formatting TRVReportHelper.

Posted: Sun Oct 26, 2008 5:43 am
by Marsianin
Everything works fine except one thing:
I'm using llPDFLib to create PDF's and when RichView text has clNone color it appears in white when using RVReportHelper.
As RVReportHelper draws on the canvas I think this is his bug.

Posted: Sun Oct 26, 2008 5:51 pm
by Sergey Tkachenko
Does this problem occur when drawing to bitmap or metafile? If yes, it is TRVReportHelper bug. If no, this is a PDFLib bug.

Posted: Sat Nov 01, 2008 8:13 pm
by Marsianin
Yeah, works fine with BMP. So it's a llPDFLib bug. But there is no response from their support for a 4 days :?