TRVReportHelper problems
TRVReportHelper problems
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;
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Add
Code: Select all
RVReportHelper1.RichView.Style := <some RVStyle component>;
RVReportHelper1.RichView.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
RVReportHelper1.RichView.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
I have another problem with it when loading RVF from stream. Here is the code:
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:
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;
for each linkhttp://www.allapp.com is not an Integer value
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: