I am currently in need of an idea, I'm developing a software solution and I have to create Words documents from BDD's information.
Everything is fine about informations's use but one point and it's the most important :
On my Word document, I use signets to repeat a table where information is written. One of the column refer to a cost, and since I'm using the signets's system, I don't know where my table end, it can take 1 page as it can take 2500's but I need to calculate at the end of EACH page a total of every row that was written on the current page, and then rewrite this total at the beginning of the next page. So it would be like :
- Page 1
nameOfTheItem1 Cost1 nameOfTheItem2 Cost2 nameOfTheItem3 Cost3 nameOfTheItem4 Cost4 TOTAL PAGE 1 : TotalPage1
- Page 2
TotalPage1
nameOfTheItem5 Cost5
nameOfTheItem6 Cost6
nameOfTheItem7 Cost7
nameOfTheItem8 Cost8
TOTAL PAGE 2 : TotalPage2(+TotalPage1)
and this for each page existing for this document.
I'm still looking for a solution by myself, and every help would be great.
It can be done with the mail merge feature of Aspose.Words. The solution is particularly related to the nested mail merge.
The following code will help you to get started. It uses dummy data of course. You can populate with your own data to make it work for you.
MS Word template document that works with this code: Download Template
Try changing the values of totalRecords and recordsPerPage variables and you will see the data arranged in pages accordingly. Just be sure to keep the recordsPerPage value low, so that it does not exceed single page.
I am a developer evangelist at Aspose.