What are the best ways to deal with these PDFSharp table limitations? - c#

I am using PDFSharp to export a table to PDF (using the regular MigraDoc.DocumentObjectModel.Tables.Table object). It works great except I ran into a few issues:
if the content of a single cell in the table is longer than the height of the page it seems like the content just gets cut off. A table itself can span multiple pages but a row seems like it can only be 1 page high and It seems like it doesn't extend onto the next page.
Is there any workaround to this or is this just a bug in the library?
Also for tables that span multiple pages, is there a way to have the header row on the table show up at the top of every page?

Re first question:
It's documented that MigraDoc does not break table rows over multiple pages. It's not a bug, it's a limitation. So it's up to you to design the tables that this does not cause problems.
IIRC there is a hack published on the PDFsharp forum that increases the page height to work around this problem. If you only need PDFfiles, this could be a workaround.
Edit: Didn't find the link when I made the post, but found it today when I tried again: Here's the workaround:
http://forum.pdfsharp.net/viewtopic.php?p=4311#p4311
I didn't try it myself.
Re second question:
Rows marked as header rows will be repeated on every new page. Just set the HeadingFormat property of those rows to true.

Related

Multi page section with title on every page in MigraDoc

I want a document with multiple pages. Every page should have the same header. One section of the document contains a long table, which stretches over multiple pages. On every page of this section I want to show a title above the table.
I came up with two solutions so far. Both seem hacky and have their downsides:
Make the title part of the header in this section. Feels wrong and is also annoying when I have other pages in the document which should contain the header but not the title.
Make the title part of the table and use HeadingFormat. Feels hacky as well because the title doesn't "fit" in the columns of the table.
Any better ideas?
Re 1: Put the table in a new section and set a new header for that section. One line can be the standard header shared by all pages, another line can be a special header for the table section.
Does not look hacky to me.
Re 2: You can set the HeadingFormat for several rows. So you can use the first row for the "header" without any border and with a MergeRight so it spans the whole page. Not really hacky and will look like normal text outside the table.
Solution 1 has a downside as every new section starts on a new page. Well, the table is so important that it even gets an own page header, so this downside should not matter.
A hacky and tricky solution would be using PDFsharp to add a special header on all pages with the table on it. I think I'd go for option 2.

Office Word Table fill page bounds

i'm developing an invoice template using Syncfusion DocIo with merge fields.
Everything works fine but i have a problem, I use a repeater for rows and every time happen that table ends at half of the page and it's not nice to see.I need that the invoice must stay at full page, fitted to the page bounds, I need something like a "dynamic spacer".
You have any suggest to keep the table stretched at bounds?
Many thanks for help

Is it possible to specify number of pages in rdcl report c#?

I have a rdcl ready to be populated.
It mainly contains a table that occupies the whole width and a few Textboxes under it that show summary info.
Sometimes the table will have a lot of lines and other times only a couple of them. This makes the texboxes to end up in the same page or a 2nd (or a 3rd) depending on the situation.
I wanna know if it is possible to so specify a jump to the next page for the textboxes.
So for example even if the table has only 1 line, and there is enough space under it to fit the texboxes info in 1 page, i want them to start at the 2nd page. And if the table is too long and occupies 1 and a half pages, the textboxes should appear in the 3rd page, and so on.
I thought of creating a 2nd report with only the textboxes but then the page numbers do not match and also the reports are showed in different windows.
Any pointers are most welcome.
As far as I know, if the report objects exits on the same rdcl you can not send them to a certain page.
You can, however, alter the "PageBreak" option on the Table to "End". This will push everything after the table onto the next page.
This will help you get the desired results you are after.
EDIT:
You could also get rid of the numerous pages all together by changing the Report property "InteractiveSize" to a height of lets say 50in. This causes the report viewer to page break much less often (every 50 inches) and would most likely place all of your content on Page 1 in the report viewer.

itextSharp: Table disappears when added to Paragraph with KeepTogether=true

I am exporting some data to a PDF and I have been using iTextSharp with a lot of success, but I just hit a wall.
I have a group of information I need to keep on a single page. This information includes a handful of other Paragraph objects and tables. I can add 3 Paragraphs to another parent Paragraph and set that parent's KeepTogether property to true and everything works great.
When I add a PdfPTable to the Paragraph with KeepTogether set to true, the table disappears. No Exceptions or error messages, the table just disappears.
Any clue as to what is happening? Is there a work around? Should I be coding differently, like is there a better parent control than Paragraph to keep text and tables together on one page?
So I fixed the issue by approaching it a different way. Now I make sure to never set a KeepTogether property to true for paragraphs or tables.
Then, when I want a Paragraph that contains child paragraphs and PdfPTables, I add it to a one column, one cell, PdfPTable with its KeepTogether flag set to true.
So that works perfectly, just a little dirty.

asp.net datagrid custom paging with pages of various sizes

I am trying to add paging to my datagrid. This datagrid stores hierarchical data. So the top row has several children rows that need to go beneath it. When a new top row type is going to be added I want to make a new page. This way all related rows will be displayed on the same page. So, I think the tricky part might be making pages with varying sizes. I am not sure how to go about attacking this issue. All of the custom paging examples I have seen still have x amount of rows per page. Like I said my pages have to all be various sizes.
Any tips would be appreciated.
I think your best bet would be to use a FormView control for your parents and then bind your children to a grid inside of it.

Categories