TRVReportHelper problems

General TRichView support forum. Please post your questions here
Post Reply
lommez
Posts: 9
Joined: Tue Sep 06, 2005 11:47 am
Location: Brazil

TRVReportHelper problems

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

Post by Sergey Tkachenko »

Add

Code: Select all

RVReportHelper1.RichView.Style := <some RVStyle component>;
RVReportHelper1.RichView.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
RVReportHelper1.RichView.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

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

Post by Sergey Tkachenko »

Include rvoTagsArePChars in RVReportHelper1.RichView.Options.
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

Post by Marsianin »

Oops, sorry, I knew it :)
But now exception raises in RVReportHelper1.RichView.Format; :shock:

Add: But it works fine without Format routine.
Sergey Tkachenko
Site Admin
Posts: 17499
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

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

Post 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.
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

Post 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 :?
Post Reply