Hello dear support team,
I’m currently working on generating PDF invoices from a *.docx template in .NET.
The main part of the invoice is a table with a variable number of rows, depending on how much items the customer bought (every row contains an item).
One special case currently gives me headaches: When invoices are longer than one page (which means they include one or more page breaks), I need a special row at the end of the “old” page and a special row at the beginning of the next page. The link leads to an example PDF to show what I mean (the special rows are the rows “Zwischensumme” and “Übertrag”). I deleted all company-related data, but I think the problem
should be clear nonetheless.
InvoiceExample_empty.pdf (271.6 KB)
I found a very hacky solution to the problem: First, I build the invoice including the table with the ReportingEngine. Then, I iterate through the table rows and for every row I check, if LayoutCollector.GetStartPage is bigger than the startpage of the previous row. If this is the case, I insert the special rows and some empty rows until “Übertrag” moves to the top of the next page.
The problem is that I have to call LayoutCollector.GetStartPage for every single row to find the point where the page breaks which eats up so much performance that the generation of a PDF with 4 pages takes up to 10 seconds.
My web research suggests that this function (with the special footer and header rows) is not supported in MS Word, so I don’t have high hopes that there is an elegant solution with Aspose.Words, but I didn’t want to miss the opportunity to ask.
If you need any more information from me, please let me know.
Thanks in advance!