标题:QAxObject 操作Word文档表格,合并单元格
作者:loveabcc
日期:2016-12-20 09:43
内容:
谁有这方面的经验,指教下,
取出Range,总是失败
错误是 QAxBase::Error calling IDispatch member Range:Unknown error
#1 [loveabcc 12-20 10:03]
自顶一下,有知道这方面知识的吗,比如说 VBA对应QT的函数,应该怎么找到对应的.
#2 [圣域天子 12-20 10:58]
我也卡在这个问题上没解决过~~~
楼主对Word操作的其它接口都搞定了吗?
开个源吧~~~学习学习
取 UsedRange 的一段代码,不知对楼主是否有用:
void TcMSWord::getUsedRange(int *topLeftRow, int *topLeftColumn, int *bottomRightRow, int *bottomRightColumn)
{
QAxObject* range = m_document->querySubObject("Range");
*topLeftRow = range->property("Row").toInt();
*topLeftColumn = range->property("Column").toInt();
QAxObject *rows = range->querySubObject("Rows");
*bottomRightRow = *topLeftRow + rows->property("Count").toInt() - 1;
QAxObject *columns = range->querySubObject("Columns");
*bottomRightColumn = *topLeftColumn + columns->property("Count").toInt() - 1;
}
#3 回 圣域天子 的帖子 [loveabcc 12-20 12:22]
圣域天子:我也卡在这个问题上没解决过~~~
楼主对Word操作的其它接口都搞定了吗?
开个源吧~~~学习学习
取 UsedRange 的一段代码,不知对楼主是否有用:
void TcMSWord::getUsedRange(int *topLeftRow, int *topLeftColumn, int *bottomRightRow, int *bottomRightColumn)
....... (2016-12-20 10:58)
加个QQ吧495259090,基本属于刚开始弄,CSDN上找了一个代码。
#4 回 圣域天子 的帖子 [loveabcc 12-21 10:44]
圣域天子:我也卡在这个问题上没解决过~~~
楼主对Word操作的其它接口都搞定了吗?
开个源吧~~~学习学习
取 UsedRange 的一段代码,不知对楼主是否有用:
void TcMSWord::getUsedRange(int *topLeftRow, int *topLeftColumn, int *bottomRightRow, int *bottomRightColumn)
....... (2016-12-20 10:58)
已经解决合并单元格
例子 合并 第一行 1-9单元格
QAxObject* cell11 = table->querySubObject(Cell(1,2));
QAxObject* cell19 = table-queryObject(cell(1,9));
cell11->dynamicCall("Merge(QAxObject*)", cell12->asVariant);
https://msdn.microsoft.com/en-us/library/aa212374(v=office.11).aspx 这里面有 VBA方法
#5 回 loveabcc 的帖子 [圣域天子 12-22 08:56]
loveabcc:已经解决合并单元格
例子 合并 第一行 1-9单元格
QAxObject* cell11 = table->querySubObject(Cell(1,2));
QAxObject* cell19 = table-queryObject(cell(1,9));
....... (2016-12-21 10:44)
cell(..)函数代码能提供一下吗?