PDFsharp & MigraDoc Foundation

Center Textframes in Table Cells
Page 1 of 1

Author:  mimmelitt [ Wed Nov 14, 2012 2:46 pm ]
Post subject:  Center Textframes in Table Cells

Hi all!

I'm stuck on a probably stupid thing. I use a Textframe to rotate a cell's value 90° counter clockwise. Now I need this textframe to be centered in its cell. I can't get it centered using the cells alignment property. Setting the alignment property works perfectly well when there's a paragraph in the cell but not when there's a textframe. Any hints for me? What am I missing?

This is what I'm doing:
     Paragraph paragraph = new Paragraph();
     paragraph.Format.Font.Color = Colors.Black;
     paragraph.Format.Shading.Color = new Color(192 << 16 | 192 << 8 | 192);
     paragraph.Format.Font.Bold = true;
     // Unfortunately this doesn't have any impact
     cell.Format.Alignment = ParagraphAlignment.Center;

     TextFrame verticalContent = cell.AddTextFrame();

     verticalContent.Orientation = TextOrientation.Upward;
     verticalContent.MarginBottom = Unit.FromMillimeter(3); 

Thanks a lot!

Author:  Thomas Hoevel [ Wed Nov 14, 2012 4:07 pm ]
Post subject:  Re: Center Textframes in Table Cells


I didn't try your code, but the answer could be something like
verticalContent.Left = ShapePosition.Center;

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group