我做了一个word模板,定义好了书签为listyd,书签是在一个表格中,在书签位置动态的生成表格,例子代码如下:var ole = new ActiveXObject("Word.Application");? var url=c:\nsqktzs_fm.doc" ????? var doc =ole.documents.open(url,false,false);? ole.Visible = true;? ole.selection.find.forward =true;var rg=ole.selection.goto(true,0,0,"listyd"); ??var tab=doc.Tables.Add(rg, 2,2) ;? for(var i=1;i<=2;i++){for(var j=1;j<=2;j++){var rgcell=tab.Cell(i,j).Range;rgcell.InsertAfter(i+j);} ??}生成的表格嵌套在以前的表格中,很难看,如何能让生成的表格和外边的表格看上去是一个整体。rgcell.InsertAfter(i+j);可以用insertBefore么。也可以考虑用java语言做word模板。②
HTML code
response.setHeader("Content-disposition", "attachment; filename="+new String("维修情况记录".getBytes("GBK"),"iso8859-1")+".doc");
%>
.oBox {
border: none;
width: 100%;
}
center {
text-align: center;
font-size: 26px;
font-weight: bold;
}
table {
border: none;
width: 100%;
border-collapse: collapse;
}
#tab td {
border: 1px solid #000000;
height: 50px;
text-align: center;
}
BG-082(ver2.0)
编号:
名称 | ${eForm.e_name } | ||
型号规格 | ${eForm.e_type } | 编 号 | ${eForm.e_format } |