empira / MigraDoc-1.5

MigraDoc Foundation - Creating documents on the fly
MIT License
218 stars 125 forks source link

calculate running totals #1

Closed fredericoregateiro closed 7 years ago

fredericoregateiro commented 7 years ago

Can i use Migradoc to generate documents with running totals on the beginning and end of a table on each page?

Thanks

ThomasHoevel commented 7 years ago

There is no simple "MigraDoc only" solution for that.

A possible "MigraDoc only" approach: Prepare a document with one large table and prepare it to get the page breaks. Then create another document with small tables, one table per page, and add the totals on each page based on the page breaks for the first document. You can add a "Tag" to each element, e.g. each paragraph in the table, so after preparing the document you can find on which page each item is.

The MigraDoc/PDFsharp approach is very similar: create the document with MigraDoc and add the totals with PDFsharp.

Either way there is no publicly available source code I'm aware of. I tried something like that and it worked, but it was not simple. Finding which paragraphs are on each page was the tricky part.

fredericoregateiro commented 7 years ago

Thanks, I will try to use PDFsharp to process the document.