Hi Team, is there any option to get current page no in linq as per attached image?
@manojdesai272 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 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");