Hello,
I am using Aspose.Words to generate a pdf document using a .docx template and a JSON data source leveraging the ReportingEngine build report functionality.
I was wondering if there are any model/properties that represent page breaks and page numbers that can be used in the template to insert text similar to the one below <<if [page_break == true]>> "Continued from <<page_number-1>>"<</if>>
@HanaLGC MS Word documents are flow by their nature, so there is no “page” concept. Consumer applications reflows document content into pages on the fly. So there is no way to get page index upon building the report.
You can try using standard MS Word IF and PAGE fields to achieve something similar to what you need:
For example see the following code and documents:
List<string> items = new List<string>();
for (int i = 0; i < 100; i++)
items.Add($"item_{i}");
Document doc = new Document(@"C:\Temp\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, items, "items");
doc.UpdateFields();
doc.Save(@"C:\Temp\out.docx");