Hi there,
I am generating a table with Migradoc and want to have a number of rows in it - and a column in the left hand side with vertical text.
What I basically do is
1. create a two-column table
2. add a number of rows
3. MergeDown all Cells[0]
4. Write a Paragraph in a TextFrame with Orientation=TextOrientation.Upward.
There is enough vertical space for all text in cell[0] to fit in the table on a single line, but nevertheless, the text is wrapped (see attached image). How do I avoid that ?
The simple source code example is given below.
Thanks a lot for any help
public void DummyReport(string reportFilename)
{
Document document = new Document();
Section section = document.AddSection();
Table dataTbl = section.AddTable();
dataTbl.Borders.Color = TableBorder;
// Two columns - the first vertical, the next horisontal
Column column = dataTbl.AddColumn("0.5cm"); // Left vertical text...
column = dataTbl.AddColumn("4.25cm");
// Create a number of rows
for (int i = 0; i <= 20; i++)
dataTbl.AddRow();
//Merge the cells in the first column and write vertical text in it
Cell leftSideCell = dataTbl.Rows[0].Cells[0];
leftSideCell.MergeDown = dataTbl.Rows.Count - 1;
leftSideCell.VerticalAlignment = VerticalAlignment.Center;
TextFrame leftTF = leftSideCell.AddTextFrame();
leftTF.Orientation = TextOrientation.Upward;
leftTF.WrapFormat.Style = WrapStyle.None;
Paragraph leftPar = leftTF.AddParagraph("How do I avoid this text getting wrapped ?");
// Now generate a pdf
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);
// Set the MigraDoc document
pdfRenderer.Document = document;
// Create the PDF document
pdfRenderer.RenderDocument();
// Save the PDF document...
pdfRenderer.Save(reportFilename);
}