DCoder
DCoder

Reputation: 3488

How to change width of single column of a table?

hello I have created table in PDF file using Itext library heading of my table columns are Medicine Name, Doses, time

My problem is: this is how my columns look like:

|Medicin|Doses|time|
| e name|     |    |

as you can see e falls in new line I have tried many things but cant figure out how to arrange my columns like :

|Medicine|Doses|time|
|  name  |     |    |

Upvotes: 1

Views: 1280

Answers (1)

Bruno Lowagie
Bruno Lowagie

Reputation: 77528

The ColumnWidths example demonstrates different ways of changing the width of a column. This is one specific way:

PdfPTable table = new PdfPTable(3);
table.setWidths(new int[]{2, 1, 1});

Now the width of the first column is double the size of the second and third column. See the complete example for other ways to change the widths of columns.

Upvotes: 3

Related Questions