how can i copy a table from a word document to a pdf in java?

  • Get the tables from the word document and use the Itext API to write them back

    List tablesList = doc.getTables();
    pdftable = new PdfPTable(3) ; // Table List Move for (XWPFTable xwpfTable : tablesList) { pdftable = new PdfPTable(xwpfTable.getRow(0).getTableCells().size()) ; List row = xwpfTable.getRows(); for (XWPFTableRow xwpfTableRow : row) { List cell = xwpfTableRow.getTableCells(); for (XWPFTableCell xwpfTableCell : cell) { if(xwpfTableCell!=null) { //table = new Table(cell.size()); pdftable.addCell(xwpfTableCell.getText()); } } } pdfdoc.add(pdftable);


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top