把整个jsp页面直接导成word文档,其中有可能包含图片等元素,我尝试着使用网上给的demo,但都是存在问题,图片导出不了。
var elTable = document.getElementById("exptable");
var oRangeRef = document.body.createTextRange();
oRangeRef.moveToElementText( elTable );
oRangeRef.execCommand("Copy");
var appWord = new ActiveXObject("Word.Application");
appWord.Application.Visible = true;
var mydoc=appWord.Documents.Add('',0,1);
myRange =mydoc.Range(0,1);
myRange.Paste();
appWord.ActiveWindow.ActivePane.View.Type=9;
appWord = null;
大家有什么好办法,求解
------解决方案--------------------
估计图片不好处理。
------解决方案--------------------
用 POI 试试。使用 HttpServletResponse 进行输出:
String filename = "words.doc";
p_response.setContentType("application/msword");
p_response.setHeader("Content-disposition",
"Attachment; filename=" + filename);
相关参考:
http://tkgospodinov.com/writing-microsoft-word-documents-in-java-with-apache-poi/
------解决方案--------------------
楼上高手,,
------解决方案--------------------
3楼版主。。。确实用插件比较好。不过图片处理不知道有用没。
------解决方案--------------------
