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)); }
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