rvreporthelper TRVReportHelper

Properties   Methods   Events

<< Click to display table of contents >>

rvreporthelper TRVReportHelper

Properties   Methods   Events

This component is similar to TRVPrint, but:

it can be used to draw on any Canvas (not only on the printer's canvas) pages of any size (not limited to printer page sizes); however, a similar functionality can be implemented using TRVPrint.VirtualPrinter;

it contains a document, not a reference to it.

Unit RVReport;

Syntax

TRVReportHelper = class(TCustomRVPrint)

Hierarchy

TObject

TPersistent

TComponent

TCustomRVPrint

How to Use

1.Load document in RVReportHelper.RichView.

2.Initialize formatting (Init). Specify the page width and canvas.

3.Format the document page by page (FormatNextPage). Pages may have different heights.

4.Draw pages on a canvas (DrawPage or DrawPageAt). If you need to know positions of hyperlinks and checkpoints, use OnDrawHyperlink and OnDrawCheckpoint events.

Example (drawing document in a metafile)

procedure TForm1.DrawToMetafile(rvh: TRVReportHelper;

  wmf: TMetafile; Width: Integer);

const VERYLARGEVALUE = $FFFFFFF;

var Canvas: TMetafileCanvas;

begin  

  rvh.IgnorePageBreaks := True;

  rvh.Init(Self.Canvas, Width);

  while rvh.FormatNextPage(VERYLARGEVALUE) do;

  wmf.Width := Width;

  wmf.Height := rvh.GetLastPageHeight;

  Canvas := TMetafileCanvas.Create(wmf, 0);

  rvh.DrawPage(1,Canvas,True,rvh.GetLastPageHeight);

  Canvas.Free;

end;

Compatibility options

Some canvases may have problems with advanced content (especially when you draw to create PDF or metafile files). In this case, you can use the properties:

MetafileCompatibility;

NoMetafiles.

Headers and footers

TRVReportHelper does not support headers and footers.

If you want to store them, you can use TRVReportHelperWithHeaderFooters class (or use srv_icon ScaleRichView).

Demo projects

Demos\*\Assorted\Graphics\ToImage\

Demos\*\Assorted\Printing\ReportHelper\