I am developing a java desktop database application in which I have to design a report. The report can either be in MS Word or the RTF format and has a fixed layout in which开发者_开发知识库 some values change according to my variables. Can I design, preview and print the document from my java application?
Yes you can for example use the OpenOffice API:
OpenOffice API
With this Java API you can build documents from scratch or open a template file to merge data into specified fields.
An example of loading a template document and merge data into user specified fields: http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Example:_Fields_in_a_Template
And then you can save as different filetypes (.rtf, .doc, .pdf, ...)
Another solution is using:
Aspose.Words for Java
Aspose.Words for Java is an advanced class library for Java that enables you to perform a great range of document processing tasks directly within your Java applications. Aspose.Words for Java supports DOC, OOXML, RTF, HTML and OpenDocument formats. With Aspose.Words you can generate, modify, and convert documents without using Microsoft Word.
If you want to know how to create these document types with Java then can i suggest you use Apose.Words:
精彩评论