|
|
Top Previous Next |
|
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); ▪it contains a document, not a reference to it. Unit RVReport; Syntax TRVReportHelper = class(TCustomRVPrint) HierarchyTObject TPersistent TComponent How to Use1.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 canvas (DrawPage or DrawPageAt). If you need to know positions of hyperlinks and checkpoints, use OnDrawHyperlink and OnDrawCheckpoint events. Example (drawing document in metafile) procedure TForm1.DrawToMetafile(rvh: TRVReportHelper; wmf: TMetafile; Width: Integer); const VERYLARGEVALUE = $FFFFFFF; var Canvas: TMetafileCanvas; begin rvh.Init(Self.Canvas, Width); // if document does not have page breaks, // it will be formatted on one page while rvh.FormatNextPage(VERYLARGEVALUE) do; wmf.Width := Width; wmf.Height := rvh.EndAt; Canvas := TMetafileCanvas.Create(wmf, 0); rvh.DrawPage(1,Canvas,True,rvh.EndAt); Canvas.Free; end; Demo projects▪Demos\Delphi\Assorted\Graphics\ToImage\ ▪Demos\Delphi\Assorted\Printing\ReportHelper\ (for C++Builder demos, change "Delphi" to "CBuilder" in the paths above) |