我现在已经用jfree生成图片了(如果能不用保存到内存直接生成到word模版中更好可以的话教下),但不知道怎么插入到现有word模版中,用jxl更好,急用,求帮助!JavaWordjfreechart图片

解决方案 »

  1.   

    什么意思?word模版中有已经生成进去的数据,我想在最后面插一张png图片进去。
      

  2.   

    我上面写的代码不行,已经删了,重写了段代码,下面这段代码放到应用程序写个main方法可以但放项目的action里就不行
    ActiveXComponent MsWordApp = new ActiveXComponent("Word.Application");
    Dispatch documents = Dispatch.get(MsWordApp, "Documents").toDispatch();
    Dispatch document = Dispatch.call(documents, "Open", "D:\\test.doc").toDispatch();
    //插入图片
    Dispatch selection = Dispatch.get(MsWordApp, "Selection").toDispatch();
    Dispatch image = Dispatch.get(selection, "InLineShapes").toDispatch();
    Dispatch.call(image, "AddPicture", "D:\\apache-tomcat-6.0.16\\temp\\chart.png");
    Dispatch.call(document, "Save");
    Dispatch.call(document, "Close", new Variant(0));
    Dispatch.call(MsWordApp, "Quit");
    MsWordApp = null;
    document = null;
    System.out.println("插入成功");
      

  3.   

    代码都是网上看的,现在我用jfree生成了图片,但不知道怎么放到word模版的最后面,如果你有思路用什么方法或插件实现告诉我也行。