0

I have some string data that needs to be printed inside a table in java. Simply formatting the text is not enough, I need to actually draw the lines of the table, have a title, header, and footer.

From my searches I found that java.swing.JTable would fulfill my conditions, however I do not need to show the table to the user at any point nor do I need to save the table in a file. I only need to print said table via a printer and JTable seems overkill for such a task, not to mention rather complicated.

Is there a better alternative for this task?

Edit: Yes, I need to print this to a Printer device. The table is fairly simple, this is an example of it. Table to output example

elpreda
  • 1
  • 1
  • Are you talking about printing to a Printer device? – Timothy Truckle Dec 18 '16 at 16:41
  • Perhaps you can show an example of the print preview of your table. After all it depends on how complicated your table looks like. There are a few alternatives. – user3437460 Dec 18 '16 at 16:41
  • You need tabular formatted out put, and the best way to get this is to use the best tool for the job, something like [JasperReports](http://community.jaspersoft.com/project/jasperreports-library). Also have a look at [this question](http://stackoverflow.com/q/15444982/522444). – Hovercraft Full Of Eels Dec 18 '16 at 16:41
  • I would also recomend You to use Jasper --> http://community.jaspersoft.com/project/jasperreports-library Because it'is a really simple case You can also use Dynamic Jasper (http://dynamicjasper.com/) to programmatically create it – Igor Vuković Dec 19 '16 at 08:51

0 Answers0