PagePrintableRect(PageNumber: Integer): IGxRect;
PagePrintableRect[PageNumber: Integer]: Prognoz.Platform.Interop.Drawing.GxRect;
PageNumber - number of the page for which you need to get printed range. Page numbering starts with one.
The PagePrintableRect property returns cell range that is to be printed on the specified page.
This property returns a rectangle, the borders of which contain coordinates of the top left and bottom right cells in the printed range.
To execute the example the repository must contain a regular report with the identifier Report_1.
Sub UserProc;
Var
MB: IMetabase;
Rep: IPrxReport;
Sheets: IPrxSheets;
Tab: IPrxTable;
TSheet: ITabSheet;
TabPrint: ITabSheetPrinter;
PrintRange: IGxRect;
PageNum: Integer;
Begin
MB := MetabaseClass.Active;
Rep := MB.ItemById("Report_1").Bind As IPrxReport;
Sheets := Rep.Sheets;
For Each Tab In Sheets Do
TabPrint := Tab.CreatePrinter;
Debug.WriteLine("Sheet: " + (Tab As IPrxSheet).Name +
"; Number of pages: " + TabPrint.GetPageCount.ToString);
TSheet := Tab.TabSheet;
Debug.Indent;
For PageNum := 1 To TabPrint.GetPageCount Do
PrintRange := TabPrint.PagePrintableRect(PageNum);
Debug.WriteLine("Page: " + PageNum.ToString +
"; Printed cell range:" +
TSheet.Cells(PrintRange.Top, PrintRange.Left, PrintRange.Bottom, PrintRange.Right).Address);
End For;
Debug.Unindent;
End For;
End Sub UserProc;
After executing this example the development environment console displays the list of regular report sheets. For each sheet there is specified the number of pages in which it is divided when printed. Printed cell range is displayed for each page.
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Imports System.Diagnostics;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Rep: IPrxReport;
Sheets: IPrxSheets;
Tab: IPrxTable;
TSheet: ITabSheet;
TabPrint: ITabSheetPrinter;
PrintRange: IGxRect;
PageNum: Integer;
Begin
MB := Params.Metabase;
Rep := MB.ItemById["Report_1"].Bind() As IPrxReport;
Sheets := Rep.Sheets;
For Each Tab In Sheets Do
TabPrint := Tab.CreatePrinter();
Debug.WriteLine("Sheet: " + (Tab As IPrxSheet).Name +
"; Number of pages: " + TabPrint.GetPageCount().ToString());
TSheet := Tab.TabSheet;
Debug.Indent();
For PageNum := 1 To TabPrint.GetPageCount() Do
PrintRange := TabPrint.PagePrintableRect[PageNum];
Debug.WriteLine("Page: " + PageNum.ToString() +
"; Printed cell range:" +
TSheet.Cells[PrintRange.Top, PrintRange.Left, PrintRange.Bottom, PrintRange.Right].Address);
End For;
Debug.Unindent();
End For;
End Sub;
This procedure is an entry point for .NET assemblies. After executing this example the development environment console displays the list of regular report sheets. For each sheet there is specified the number of pages in which it is divided when printed. Printed cell range is displayed for each page.
See also: