We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get current page of word document by reporting engine

Hi Supporters,
I would like to get the current page of word document by reporting engine in order to do some calculation within the template, Is there any way? Understand that’s we have {Page} which stand for the current page however it’s using Mail Merge so we can’t do the calculation with merged data of reporting engine.


You can use LINQ Reporting engine to export reports. After generating the report, you can use LayoutCollector.GetStartPageIndex method to get the page number of a node in the document.

Could you please share some more detail about your requirement along with input and expected output documents? We will then provide you more information on it.

Hi @tahir.manzoor,
Thanks for fast reply.

Sorry if not being clear enough. Actually our purpose is calculating the page number with value which we receive from the JSON (this value will be merged by reporting engine). Please check the attachment then you can see a file which we try to calculate the page number with both reporting engine and mail merge and it’s not working as our purpose tho. That’s why we’re asking for something look like {Page * MERGEFORMAT} but it will use reporting engine format to do calculation.
Note: LayoutCollector.GetStartPageIndex won’t work for our case but we wanna control it within the template instead of source code.

aspose_issue_with_page_number_using_reporting_engine.zip (85.6 KB)


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi @tahir.manzoor,
I attached the link below which include the input word document and the console application. Please help to check it, thanks.



We are working over your query and will get back to you soon.


We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-21020 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.


It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-21020) as ‘Not a Bug’.

Please refer to the following article.
Template Syntax

A tag body must not be located inside markup document nodes such as StructuredDocumentTag, CustomXmlMarkup, or SmartTag.

Please do not use template syntax in content control. We have attached the modified input Word document with this post for your kind reference. input-modified.zip (13.6 KB)