PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MigraDoc center table in a page

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
cquadalti



Joined: 13 Feb 2008
Posts: 2

PostPosted: Wed Feb 13, 2008 7:57 am    Post subject: MigraDoc center table in a page Reply with quote

I can't center a table in a page. I insert two paragraph: one for logo, one for title and then a table with 2 columns, all centered in the page but the property table.Format.Alignment = ParagraphAlignment.Center not center the table. Where is the problem? here my code, thanks!

// Add a paragraph to the section
Paragraph logoParagraph = section.AddParagraph();
Paragraph logotextParagraph = section.AddParagraph();

// Add some text to the paragraph
logoParagraph.Format.Alignment = ParagraphAlignment.Center;
MigraDoc.DocumentObjectModel.Shapes.Image logo = logoParagraph.AddImage(Server.MapPath("/Account/logobmp.BMP"));
logo.Height = "60pt";
logo.LockAspectRatio = true;

logotextParagraph.Format.Alignment = ParagraphAlignment.Center;
logotextParagraph.AddFormattedText("Modulo Account", boldFont);
logotextParagraph.Format.SpaceBefore = "1cm";
logotextParagraph.Format.SpaceAfter = "1cm";

// Create the item table
MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
table.Format.Alignment = ParagraphAlignment.Center;
table.Borders.Width = 0.5;
table.Borders.Left.Width = 0.5;
table.Borders.Right.Width = 0.5;

MigraDoc.DocumentObjectModel.Tables.Column column;

// Before you can add a row, you must define the columns
column = table.AddColumn();
column.Width = "2cm";
column = table.AddColumn();
column.Width = "5cm";
Back to top
View user's profile Send private message
cquadalti



Joined: 13 Feb 2008
Posts: 2

PostPosted: Mon Feb 18, 2008 3:10 pm    Post subject: Reply with quote

There is another method or tecnique for center a table?
table.Format.Alignment = ParagraphAlignment.Center doesn't work.
Back to top
View user's profile Send private message
chf



Joined: 14 Mar 2008
Posts: 2

PostPosted: Fri Mar 14, 2008 1:13 am    Post subject: Table alignment Reply with quote

Could you resolve this issue? I've same problem.
table.Format.Alignment = ParagraphAlignment.Center doesn't work because this property is for cells alignment.
Back to top
View user's profile Send private message
chf



Joined: 14 Mar 2008
Posts: 2

PostPosted: Fri Mar 14, 2008 2:38 am    Post subject: Reply with quote

I found a solution for this issue.

TextFrame addressFrame;
addressFrame = section.AddTextFrame();
addressFrame.LineFormat.Width = 0.5; //Only for visual purposes
addressFrame.Height = "15.0cm";//any number
addressFrame.Width = "10.0cm";//sum of col widths
addressFrame.Left = ShapePosition.Center;
addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;//irrelevant
addressFrame.Top = "10.0cm";//irrelevant
addressFrame.RelativeVertical = RelativeVertical.Page;//irrelevant

Table table = addressFrame.AddTable();
//Here other table parameters

Enjoy
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com