I am using Aspose PDF for .NET to attempt to render some reports.
I am trying to render two tables on a single PDF Document using the table object. Both tables are quite long and therefore go into multiple pages.
I am currently setting up the first table populating it with data and then adding it to the page. Then I am taking a new page, setting up a new table then adding it to the next page
// Add the first table
Page page = doc.Pages.Add();
Table table;
SetupTable(out table); Row newRow;
foreach(DataRow dr in dt.Rows)
{ newRow = table.Rows.Add();
}
page.Paragraphs.Add(table);
page = doc.Pages.Add();
SetupTable(out table);
foreach(DataRow dr in dt2.Rows)
{ newRow = table.Rows.Add();
}
page.Paragraphs.Add(table);
The result of all this is the first part of table 1 appears in page 1, then on page 2 I get the first part of table 2. Then in the next pages I get the remaining parts of table 1 and table 2.
Thanks for your inquiry. Please do not add new page again. Your second table will automatically starts after first table. Please remove highlighted code, it will help you to accomplish the task.
// Add the first table
Page page = doc.Pages.Add();
Table table;
SetupTable(out table); Row newRow;
foreach(DataRow dr in dt.Rows)
{ newRow = table.Rows.Add();
}
page.Paragraphs.Add(table);
page = doc.Pages.Add();
SetupTable(out table);
foreach(DataRow dr in dt2.Rows)
{ newRow = table.Rows.Add();
}
page.Paragraphs.Add(table);
Please feel free to contact us for any further assistance,
Thanks for your feedback. As another workaround for page break, you can achieve your requirements by using IsInNewPage property of first row, it will always start table from new page.
…
row1.IsInNewPage = true;<o:p></o:p>
…
Please feel free to contact us for any further assistance.
Okay that is good to know but it there anyway to just take a gap between the tables.
We currently have reports that can do this generated by another means, I am looking at bringing a few different solutions we have to generating PDF Reports into one solution.
Thanks for the support. I seem to be making progress and was quite close to getting out what I wanted but every now and then I run into the following error.
Non-negative number required. Parameter name: count
I could send full details of the error but it occurs when the document is saved. I have attached an example project of when it occurs. In this example project if you do the table gaps through the tabbed method then it work but as soon as you use the paging method it breaks.
I have actually had this error a few times when trying to do this grouping. It also occurs on my actual project when I do double grouping and change the repeated rows to 3 but this was harder to make a example Project for so I am hoping this is enough for you guys to debug from.
I have included my code but have removed my licence file as I assume these shouldn’t be posted here.
I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-36636 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.
I only ask as I am on the months free trial and therefore I’m keen to see this working before the trial runs out. I am testing out a piece of functionality that we would like to add to our application but won’t be need to run a Proof of Concept on the item before we commit to buying any new software.
Thanks for your inquiry. We have a good news for you, your above reported issue has been resolved and its fix will be included in upcoming release of Aspose.Pdf for .NET i.e. 9.1.0. Hopefully it will be published within this week. However, we will notify you via this forum thread as soon as it is published and gets available for download.