从来没有这么做过,个人有个想法:
在后台读取相关HTML页面的源代码,然后解析。将解析后的结果对应成Word的格式,然后生成Word。

解决方案 »

  1.   


    import com.jacob.activeX.ActiveXComponent;
    import com.jacob.com.Dispatch;
    import com.jacob.com.Variant;
    public class ExcelToHtml {
        public static void excelToHtml(String xlsfile, String htmlfile) {
            ActiveXComponent app = new ActiveXComponent("Excel.Application"); // 启动word
            try {
                app.setProperty("Visible", new Variant(false));
                Dispatch excels = app.getProperty("Workbooks").toDispatch();
                Dispatch excel = Dispatch.invoke(
                        excels,
                        "Open",
                        Dispatch.Method,
                        new Object[] { xlsfile, new Variant(false),
                                new Variant(true) }, new int[1]).toDispatch();
                Dispatch.invoke(excel, "SaveAs", Dispatch.Method, new Object[] {
                        htmlfile, new Variant(44) }, new int[1]);
                Variant f = new Variant(false);
                Dispatch.call(excel, "Close", f);
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                app.invoke("Quit", new Variant[] {});
            }
            System.out.println("转换成功!");
        }  
        public static void main(String[] args) {
            String paths = new String("I:\\testEXCEL.xls");
            String savepaths = new String ("I:\\resultEXCEL.html"); 
            excelToHtml(paths, savepaths);
        }
    }  
      

  2.   

    类型的三楼的作用应该可行吧,把xls改为word也类似
    用poi工具应该也行
      

  3.   

    你这个不是excel另存为html文件吗?跟楼主的问题有关?
      

  4.   

    iText 可以。先提供图片存放的路径,然后加入到代码中结合文字就可以生成word
      

  5.   

    过来结贴  问题解决了  呼~  用的是docx4j包
      

  6.   

    用jacob之类的插件,应该是可以的以前用过OpenOffice将word转换成html,调用OpenOffice的接口就能搞定或者还有一种思路,就是用word的书签功能,然后通过word插件给书签赋值,包括文本、图片都可以,WebOffice插件可以看看
      

  7.   

    哥们 我这有个demo 大体用的是docx4j包  邮箱发给我  现在再公司不能发
      

  8.   

    邮箱 [email protected]
    小弟也需要啊  求分享
      

  9.   

    http://blog.sina.com.cn/s/blog_4d7351c10100g1ct.html相关的一个帖子。
      

  10.   

    小弟也需要啊  求分享
    邮箱   [email protected]非常需要
    非常 非常需要