**
* 在指定行前面增加行
*
* @param tableIndex
* word文件中的第N张表(从1开始)
* @param rowIndex
* 指定行的序号(从1开始)
*/
public void addTableRow(int tableIndex, int rowIndex) {
// 所有表格
Dispatch tables = Dispatch.get(doc, "Tables").toDispatch();
// 要填充的表格
Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex)).toDispatch();
// 表格的所有行
Dispatch rows = Dispatch.get(table, "Rows").toDispatch();
System.out.println(Dispatch.get(rows, "Count"));
// 要增加行的行数
Dispatch row = Dispatch.call(rows, "Item", new Variant(rowIndex)).toDispatch();
//Dispatch row = Dispatch.call(rows, "Row", new Variant(rowIndex)).toDispatch();
Dispatch.call(rows, "Add", new Variant(row));
}
// 要增加行的行数
Dispatch row = Dispatch.call(rows, "Item", new Variant(rowIndex)).toDispatch();
这一句抛了一个异常: com.jacob.com.ComFailException: Invoke of: Item
Source: Microsoft Word
Description:
有没有猛人指点一二???????????????????????????????????????
* 在指定行前面增加行
*
* @param tableIndex
* word文件中的第N张表(从1开始)
* @param rowIndex
* 指定行的序号(从1开始)
*/
public void addTableRow(int tableIndex, int rowIndex) {
// 所有表格
Dispatch tables = Dispatch.get(doc, "Tables").toDispatch();
// 要填充的表格
Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex)).toDispatch();
// 表格的所有行
Dispatch rows = Dispatch.get(table, "Rows").toDispatch();
System.out.println(Dispatch.get(rows, "Count"));
// 要增加行的行数
Dispatch row = Dispatch.call(rows, "Item", new Variant(rowIndex)).toDispatch();
//Dispatch row = Dispatch.call(rows, "Row", new Variant(rowIndex)).toDispatch();
Dispatch.call(rows, "Add", new Variant(row));
}
// 要增加行的行数
Dispatch row = Dispatch.call(rows, "Item", new Variant(rowIndex)).toDispatch();
这一句抛了一个异常: com.jacob.com.ComFailException: Invoke of: Item
Source: Microsoft Word
Description:
有没有猛人指点一二???????????????????????????????????????
解决方案 »
- request对象的一点问题
- 求助:关于select option格式控制问题
- Web运行的流程
- taglib中<html:option>动态加载数据库数据
- http访问的文件时的字母大小写出现的错误
- 连接sql server,请问错在哪里,在线急救
- 对请求的url进行encode
- 大家看看,这是什么错误:Compile failed; see the compiler error output for details.
- 谁有java或jsp的帮助文件,寄个给我,100全给了!不够还给
- myEclipse打不开jar包里的xml文件,求解
- JPA比较罕见的应用,谁能解决?
- 网页被挂马,得到加密代码,请帮忙解密,谢~
new Object[] { new Integer(rowIndex) }, new int[1])
.toDispatch();用这个试一下,