PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

How to center a table on a page?
http://forum.pdfsharp.de/viewtopic.php?f=2&t=843
Page 1 of 1

Author:  t800t8 [ Thu Aug 20, 2009 2:33 am ]
Post subject:  How to center a table on a page?

I tried to search on the forum but didn't find any answer.

I want to put a table at the center of the page, how can I do it?

Thanks

Author:  t800t8 [ Thu Aug 20, 2009 10:16 am ]
Post subject:  Re: How to center a table on a page?

I mean by MigraDoc.

Nobody can help?

Author:  t800t8 [ Fri Aug 21, 2009 2:09 am ]
Post subject:  Re: How to center a table on a page?

Found the question myself.

To center a table on a page, you need to add it to a TextFrame then set TextFrame.Left = ShapePosition.Center. And you MUST set value for TextFrame.Width.

Funny that if I don't set value for TextFrame.Width, it's 0, but the table still appears.

Hope that help somebody.

Author:  thmjpr [ Tue Aug 25, 2009 8:46 pm ]
Post subject:  Re: How to center a table on a page?

thanks

On a related note, here is how I moved the table farther left:
Code:
addressFrame.MarginTop = "0.5cm"     //space above table
addressFrame.Height = "5cm"          //height of table
addressFrame.MarginLeft = "-1cm"     //position to the left of margin


Or to move the margins for the whole section instead:
Code:
section.PageSetup.LeftMargin = "1cm"    //use small page margins (tables can be farther left)
section.PageSetup.RightMargin = "1cm"   //use same margin on right so center will work correctly

Author:  t800t8 [ Mon Aug 31, 2009 8:58 am ]
Post subject:  Re: How to center a table on a page?

The problem is now change to "How to center a long table which expand on multiple pages?"

For a short table (fit into one page), it's OK to put it into a TextFrame. But as I tried, the TextFrame didn't expand on multiple pages, so the table was cut.

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

Author:  Kevin [ Wed Mar 06, 2013 1:03 am ]
Post subject:  Re: How to center a table on a page?

See this thread: http://forum.pdfsharp.net/viewtopic.php?f=2&t=856

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