Posted by a ceTe Software moderator
Hello,
You can avoid text wrapping in the cell by adding the contents using Label page element. You will need build a Label class object and set the Label width as column's width. Also make sure that you are setting the desired height for the label so that it can fit only one line of text and then add this label object to the cell of the Table2. Below is the sample code for it.
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a table
Table2 table = new Table2(0, 0, 600, 600);
//Add columns to the table
Column2 column1 = table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add();
row1.Cells.Add("Header 1");
Row2 row2 = table.Rows.Add();
//Build Label page element by setting width as column's width.
Label label = new Label("This is to test of text wrapping", 0, 0, 150, 20,Font.Helvetica,12);
//Add the label to the cell of the Table2.
Cell2 cell1 = row2.Cells.Add(label);
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(@"C:\MyDocument.pdf");
If the above suggestions do not meet your requirements then please send over more details about your requirements to our
support team so that they can look into it further.
Thanks,
ceTe Software Support Team.