How to use the document page number on export?
I need to include a page number/index in the export, how can I get the current page number? the document will have 11 page, one for cover page, and 10 tickets page, when exported to excel spreadsheet, I will like to any the row 1,2,3,4,5,6,7,8.9.10 appear on the export file.
General approach for such task is to use the script to iterate through the document pages and save the pages numbers in corresponding fields or other places which than could be used on export or elsewhere according to your purpose.
The page position in the document is described by the "Index" property of IPage scripting object.
To iterate through the pages in the document please consider using "for"-cycle as the in the C# rule script snippet below (pages enumeration starts from 0):
for (int i=0;i<Context.Document.Pages.Count-1;i++)
... //int sourcePageNumber = Context.Document.Pages[i].ImageSourcePageNumber;
Note. The approach above does not take into account the position of the page in the original multipage file. The approach allows to retrieve the number of page in the document after the document assembling is finished.
In case you require to return the page position in the initial multipage image file please refer to the IPage scripting object property "ImageSourcePageNumber".