Show Running Total Variable in Footer of Template Word DOCX Document using C# .NET or Java | LINQ Reporting

Hi,

I have document where I need to have a running total in the footer of each page. I have tried a Linq template variable, but it only renders the initial value. Is there a way to render the current value of the variable in a footer in Words?

Thanks,

@bstuba,

Please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words for .NET 20.10 generated output DOCX file showing the undesired behavior
  • Your expected DOCX file showing the desired output. You can create this document manually by using MS Word.
  • Please also create a standalone simple Console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your particular scenario/issue and provide you more information.

FooterUpdateExample.zip (22.5 KB)

Input and output DOCX attached. There is no data in this example, just a straight Aspose Render.

It would seem that the behavior I am seeking is counter to the design of Word headers/footers. The input doc has a variable X which is incremented on each page and X placed in the header and footer. Unless I create a new section on each page of the template, X is rendered with it’s initial value. Is there some way to pass the value of X to Word so that it updates on each page in the similar manner to the way Word’s page number fields work?

@bstuba,

Yes, it is by MS Word design that the same header/footer content will appear on all pages in a Section of Word document. One way is to generate N number of One-Page documents for each data record and at the end merge those small documents into one. In this case, there will be various Sections (containing separate headers/footers) in final document.