当前位置:编程学习 > JAVA >>

求jsp导出word的可用例子

我用iText5.3.3生成了Pdf文件。
用POI3.9生成Excel文件。

网上说可以用iText和POI生成word, 弄了半天都不行。
谁有完整可运行的demo ? jsp word --------------------编程问答-------------------- 不懂。就做过excel --------------------编程问答--------------------

public static void main(String[] args) throws IOException {
XWPFDocument doc = new XWPFDocument(); 
XWPFParagraph p1 = doc.createParagraph();
XWPFRun r1 = p1.createRun();
r1.setText("hello world");
FileOutputStream out = new FileOutputStream("D:\\simple.docx"); 
doc.write(out);  
out.close(); 
}

出POI外还需要xmlbeans-2.3.0.jar和dom4j-1.6.1.jar --------------------编程问答-------------------- 二楼的!支持 --------------------编程问答--------------------
引用 2 楼 longtian1213 的回复:

public static void main(String[] args) throws IOException {
XWPFDocument doc = new XWPFDocument(); 
XWPFParagraph p1 = doc.createParagraph();
XWPFRun r1 = p1.createRun();
r1.setText("hello world");
FileOutputStream out = new FileOutputStream("D:\\simple.docx"); 
doc.write(out);  
out.close(); 
}

出POI外还需要xmlbeans-2.3.0.jar和dom4j-1.6.1.jar


引用 2 楼 longtian1213 的回复:

public static void main(String[] args) throws IOException {
XWPFDocument doc = new XWPFDocument(); 
XWPFParagraph p1 = doc.createParagraph();
XWPFRun r1 = p1.createRun();
r1.setText("hello world");
FileOutputStream out = new FileOutputStream("D:\\simple.docx"); 
doc.write(out);  
out.close(); 
}

出POI外还需要xmlbeans-2.3.0.jar和dom4j-1.6.1.jar

学习了
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,