在jsp页面,将页面中显示的内容,生成word。这个怎么做呢?SSH框架,怎么实现

2025-04-29 02:55:39
推荐回答(1个)
回答1:

//获取页面内容
//调用word组件
//生成新文件
var table=document.getElementByIdx_x('printTable');
 row=table.rows.length;
   column=table.rows(1).cells.length;
  
 var word = new 
ActiveXObject("Word.Application");
 word.Application.Visible = 
true;
 word.Selection.Text ="<%=reportTitle%>";
 var 
mydoc=word.Documents.Add('',0,0);
 myRange 
=mydoc.Range(0,1);
 var 
sel=document.body.createTextRange();
 sel.moveToElementText(table);
 sel.select();
 sel.execCommand('Copy');
 myRange.Paste();