TRVReportHelper problems
Posted: Thu Nov 24, 2005 12:16 am
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;
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;