I'm using Aspose.PDF .NET 10.4 (latest as of this writing). I'm using their DOM api (not generator as that's deprecated).
How do I rotate text in a table cell 90 degrees counterclockwise?
Here's what I tried but the rotation on a rectangle had no affect.
Table table = new Table();
table.DefaultCellBorder = new BorderInfo(BorderSide.All, 1f, Color.Black);
table.DefaultCellPadding = new MarginInfo(5, 5, 5, 5);
var headerRow = table.Rows.Add();
headerRow.FixedRowHeight = 100;
headerRow.DefaultCellTextState.HorizontalAlignment = HorizontalAlignment.Center;
for (int hc = 0; hc < 20; hc++)
{
var cell = headerRow.Cells.Add();
cell.BackgroundColor = Color.Red;
cell.DefaultCellTextState.ForegroundColor = Color.White;
cell.DefaultCellTextState.FontStyle = FontStyles.Bold;
var h = new TextFragment("header-" + hc);
h.Rectangle.Rotate(270); //this does nothing
cell.Paragraphs.Add(h);
}
for (int r = 0; r < 15; r++)
{
var row = table.Rows.Add();
for (int c = 0; c < 20; c++)
{
row.Cells.Add(r + "-" + c);
}
}
Document doc = new Document();
Page page = doc.Pages.Add();
page.Paragraphs.Add(table);
doc.Save("c:\temp\table.pdf");
How about something like: