I have done the following, but wondering how to get the layout in my pdf files? I mean the bordering, tables and so on. OfCourse, this is not the final thing that I will end up.this is just a start.so there might be some stupid code standards followed. How to read pdf file and write it to excel file in csv format. The link of code and package is. And the code is.
I have created an excel file with Apache POI. And now I need convert it to PDF. I want to use iText, but I want copy the merged cell, styles, etc from excel file to pdf.
How can I achieve this? Because the code sample I've found on the web: PDF to Excel using iText and Apache POI is good but doesn't copy the merged cells, styles.
Any ideas? Thank you very much !
Joris Schellekens1 Answer
If you are going to use iText, it's best to use iText7. This is the latest version of iText, and substantial bugfixing has been done (especially for tables).
That having been said, when I look at the example, it seems like the example just iterates over all the cells and adds them to an iText Table object.
The exact same thing can be done with iText7. You create a table with the proper amount of columns, and then add cells to it.
Your question (as far as I'm concerned) comes down to 'how can I style iText table cells'.
This is a piece of sample code that just generates a table. I have indicated where you can style the content of the table.
Check out more examples at http://developers.itextpdf.com/content/itext-7-examples/itext-7-tables
Joris Schellekens