Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

  1. 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?

  1. 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?
like image 962
leora Avatar asked Feb 19 '23 17:02

leora


1 Answers

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.

like image 152
I liked the old Stack Overflow Avatar answered Apr 29 '23 20:04

I liked the old Stack Overflow