Java如何生成带表格的word
求高人指导,之前用FreeMarker生成word,现在又有表格的word,表格是不确定的,不知怎么做了
------解决方案--------------------Jacob
public void createTable(int numCols, int numRows) {
Dispatch tables = Dispatch.get(doc, "Tables" ).toDispatch();
Dispatch range = Dispatch.get(selection, "Range" ).toDispatch();
Dispatch newTable = Dispatch.call(tables, "Add" , range,
new Variant(numRows), new Variant(numCols)).toDispatch();
Dispatch.call(selection, "MoveRight" );
}