Create Openoffice document with template in Java Solution

POI is not supported well to create open office document (calc, spreadsheet), it’s working fine for MS Excel (only).

I would clarify my point with POI, it’s not working to set Khmer Unicode font to Openoffice document that could block us to use it well in JODConverter.

So another solution should be applied for manipulate the open office document, I have found JODReports according to the discussion at StackOverflow which is coming from 3 interesting libraries to try:

And since I am interesting to work with report template rather than pure hard coded in the source file, I’d like to tried JODReports than other in the first sight.

DocumentTemplateFactory templateFactory = new DocumentTemplateFactory();
DocumentTemplate template = templateFactory .getTemplate(new File("template.odt"));
Map data = new HashMap();
data.put("title", "Title of my doc");
data.put("picture", new RenderedImageSource( File("/tmp/lena.png"))));
data.put("answer", "42");
template.createDocument(data, new FileOutputStream("output.odt"));

And another interesting point on JODReports, it would work fine with JODConverter that allows the report to be converted to PDF, Word, RTF, etc.

Of course, more research/test should take over on it.

If you are also interested to try as well go together with JODReports and share your though and experiences with us.



Let’s share how do you think? Or any other solutions better?

Updated 08/08

Forget my judgement on POI and JODReports, they are in different context. POI is for spreadsheet and JODReports is for text document.

I’m slightly make a mistake in my post above to mix: POI & JODReports together but it’s really a different purpose. Here my purpose to seek for the library that could make PDF reports well. By using JODReports we could make openoffice document (though it’s for spreadsheet) and using JODConverter to convert the report (in Khmer Unicode) working fine but stuck on how to make Openoffice spreadsheet in Java to support Khmer Unicode since POI can’t set font name on any cell.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.