public void generateDoc(String text,int size, File file) throws Exception {
XWPFDocument document = new XWPFDocument();
XWPFParagraph tmpParagraph = document.createParagraph();
XWPFRun tmpRun = tmpParagraph.createRun();
tmpRun.setText(text);
tmpRun.setFontSize(size);
document.write(new FileOutputStream(file));
}
Friday, 8 June 2012
Java: Generate Microsoft Word document
Subscribe to:
Post Comments (Atom)
You can create word document from scratch by using Aspose.Words for Java Library. This Library offers many other features also. Try it, i hope you will like it also.
ReplyDeletehttp://www.aspose.com/java/word-component.aspx
Aspose is $999/year for a single develoepr.. and apache is free, isn't it?
ReplyDelete