How to add 3 new columns?

Keith Yung

I'm new to itext 7. So I'm trying to get the hang of making tables but for reason, the cells only seem to be stacked to each other. How do I create a new column?

  Table table1 = new Table(5); // 3 columns.

        table1.addCell("test");
        table1.addCell("test");
        table1.addCell("test");

I keep getting this kind of design, no matter how many combinations or new Cells I've tried. I wanted to have 3 columns instead of 3 rows on one column.

enter image description here

Franziskus Karsunke

I think you are confounding rows and columns. First you are creating a Table with 5 Columns.

Table table1 = new Table(5);

Whenever you add a cell it will be added as a new column. When you added 5 Columns and add another one, then the new one will create a new row.

table1.addCell("test");
table1.addCell("test");
table1.addCell("test");
table1.addCell("test");
table1.addCell("test");
table1.addCell("test"); // this one will be added in a new row

Note that incomplete rows aren't added by default, unless you ask iText to complete the rows (see Why is content missing in my table?).

If you want to span one cell over more than one row or column you can set the rowspan or columnspan of the cell. See the Colspan and rowspan examples on the official web site.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to add 3 columns in flutter?

How to add multiple new columns with a fixed value?

How to Add, Delete new Columns in Sequelize CLI

How to compare columns and add a new column

How to add new columns considering previous years?

How to rename existing columns add new columns in an array?

How to add new columns according to other columns in pandas?

How to break one field into 3 new columns

Add a new row after every 3 columns are created

How to add 10 equal columns in the Bootstrap 3

How to add 2 rows and 3 columns images?

How to add new email to CNMutableContact in Swift 3?

How to add new row which copy's some columns, but assigns new values in other columns

How to drop and add a new list of columns to a .csv file?

How to add new column, where the value is based on existing columns with awk

How to add new row based on values from columns

How to add new columns based on conditions (without facing JaninoRuntimeException or OutOfMemoryError)?

How to add new columns in text file with multiplication of several sequence?

How to add multiple new columns with when condition in pyspark dataframe?

How to iteratively add tuple elements to a dataframe as new columns?

How to explode pandas and add new rows and columns based on condition

How to add numpy matrix as new columns for pandas dataframe?

Pandas dataframe: how to apply describe() to each group and add to new columns?

how to add new row to pandas dataframe based on other columns?

Mysql ,how to add two new columns and insert data at the same time?

How can I add new columns to a dataframe with grouped amounts in percentage?

how to add a new column between 2 columns in laravel

how to add new columns with region and iso(for mapping) in R?

How to add new columns into pandas Series based on existing column