When adding/creating a new table header ( rwHeader.Cells.Add("Header 1")), how can I change the orientation of the text?
I know the Add method takes a PageElement, and I know the Label element has an Angle property, but I would have to specify the x and y co-ordinates using this technique.
Cell Header Orientation
Re: Cell Header Orientation
Support · Nov 14, 2011Hello,
When you are using the Label inside a table cell you would need to use correct X and Y co-ordinates with respect to the cell. Below is the sample code that illustrates how to do this.
Document document = new Document();
Page page = new Page();
Table table = new Table(0, 0, 400, 400);
int columnwidth = 90;
table.Columns.Add(columnwidth);
table.Columns.Add(columnwidth);
int rowheight = 55;
Row row1 = table.Rows.Add(rowheight);
Label label = new Label("Column 1", (table.BorderWidth + table.X), (table.Y + rowheight), 60, 60);
label.Angle = -90F;
row1.Cells.Add(label);
Label label2 = new Label("Column 2", (table.BorderWidth + table.X), (table.Y + rowheight), 60, 60);
label2.Angle = -90F;
row1.Cells.Add(label2);
Row row2 = table.Rows.Add(Font.HelveticaBoldOblique, 12);
row2.Cells.Add("Name");
row2.Cells.Add("Address");
page.Elements.Add(table);
document.Pages.Add(page);
document.Draw(@"C:\MyDocument.pdf");
Thanks,
ceTe Software Support Team.