How to change width of single column of table?

I am looking to change the width of a column to fit a longer word.

31st May 2016
admin-marketing

hello I have created table in a PDF file using iText. The heading of my table columns are "Medicine Name", "Doses", and "time: This is what my columns look like:

 

|Medicin|Doses|time|
| e name|     |    |
As you can see the word "Medicine" is split into "Medicin" and "e". I want to avoid this by changing the width of the first column, but I don't know how to do that.

Posted on StackOverflow on Jun 10, 2014 by DCoder

The ColumnWidths example demonstrates different ways of changing the width of a column. Note that the way we create tables in iText 7 differs from the iText 5. PdfPTable class doesn’t exist anymore. This is one specific way:

Table table = new Table(new float[]{2, 1, 1});

Now the width of the first column is double the size of the second and third column.

Click this link if you want to see how to answer this question in iText 5.


Share this article

Contact

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now