I used itext7, the code for creating the tables are very simple:
float[] tableWidth = {75, 75, 75};
Table table1 = new Table(tableWidth);
table1.addHeaderCell("head \n1");
table1.addHeaderCell("head \n2");
table1.addHeaderCell("head \n3");
table1.addCell("column 1");
table1.addCell("column 2");
table1.addCell("column 3");
Table table2 = new Table(tableWidth);
table2.addHeaderCell("head 1");
table2.addHeaderCell("head 2");
table2.addHeaderCell("head 3");
table2.addCell("column 1");
table2.addCell("column 2");
table2.addCell("column 3");
document.add(table1);
document.add(new Paragraph("\n"));
document.add(table2);
I created two tables, only difference: head in table1 is with new line "\n":
Till here not any problem. But my question is when I tried to select and copy the tables from the generated PDF file and paste to MS-Word for example, I got different result: head of table1 is copied in vertical sequence:
As in my pratical code, I have to use "\n" in the table head, with this the table was then not able to be copy-pasted correctly, any clue?