PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

How to center a long table which expand to multiple pages?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=856
Page 1 of 1

Author:  t800t8 [ Tue Sep 01, 2009 9:31 am ]
Post subject:  How to center a long table which expand to multiple pages?

I tried to put the long table into a TextFrame and then set the TextFrame to center. But the TextFrame won't expand to multiple pages, so the table was cut off.

How to center a long table which expand to multiple pages?

Author:  Thomas Hoevel [ Tue Sep 01, 2009 11:13 am ]
Post subject:  Re: How to center a long table which expand to multiple pages?

One way: use sections
Knowing the width of the table and the width of the paper, you can easily center the table using document.LastSection.PageSetup.LeftIndent.

This settings affects everything in the section, but you can change the LeftIndent of any paragraph or shape in the section. You can also use negative values to compensate for the table indentation.

You can create as many sections as you need - but a new section always starts with a pagebreak.

Another way: use dummy columns
You can also add a column at the left of the table. Leave this column empty. Set border, color, and content only for the non-dummy columns of the table.
Calculate the width of the dummy column based based on the width of the paper and the table.

This may require some adjustments at your code that creates the table.

What's best?
That depends on your table and your needs.

Author:  t800t8 [ Tue Sep 01, 2009 2:42 pm ]
Post subject:  Re: How to center a long table which expand to multiple pages?

Thomas,

Thanks for the answer. But it should be a place for improvement of PdfSharp. Can I expect it in near future?

BTW, I will use dummy columns.

Regards

Author:  Thomas Hoevel [ Tue Sep 01, 2009 4:15 pm ]
Post subject:  Re: How to center a long table which expand to multiple pages?

t800t8 wrote:
But it should be a place for improvement of PdfSharp. Can I expect it in near future?

I put it on the MigraDoc wish list - but I can't say when it'll come.

Until you asked (in that other thread) I didn't even know that tables don't support indentation (or if they do, I missed it).

Our applications only use left-aligned or full-width tables. And I don't recall anybody else asking for it.

Author:  Thomas Hoevel [ Thu May 12, 2011 1:00 pm ]
Post subject:  Re: How to center a long table which expand to multiple pages?

Hi!

This feature is implemented, but not where I expected it.

Set table.Rows.LeftIndent to indent table.
To center the table, calculate the appropriate indentation.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/