js 设置表格列宽问题
function dynamicCreateTable()
{
//alert("创建表格!");
var mydoc = TANGER_OCX_OBJ.ActiveDocument; //得到Document对象
var app = mydoc.Application; //得到Application对象
var sel = app.Selection; //得到Selection对象
tables = mydoc.Tables;
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.GoTo(-1,0,0,'table');
var newTable = tables.Add(sel.Range,row,column,1,0);
mydoc.Tables(1).Cell(1,1).range.Text ="aa";
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.Tables(1).Columns(1).PreferredWidth = CentimetersToPoints(1.0)
}
var row = 4;//表的行数,这个值由后台编程实现
var column = 3;//表的列数,这是值由后台编程实现
运行后,表格与内容显示正常,列宽没有变化,“TANGER_OCX_OBJ.ActiveDocument.Application.Selection.Tables(1).Columns(1).PreferredWidth = CentimetersToPoints(1.0)”一句报错:“集合所要求的成员不存在”。
如何解决