查看完整版本: [-- QT操作word文档 --]

QTCN开发网 -> Qt基础编程 -> QT操作word文档 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

tell青青 2017-04-24 15:24

QT操作word文档

如何在用QAxObject为word文档的某个位置插入一个大小可以设置的图片
插入图片的例子:

void QWord::insertCellPic(int row, int column, const QString& picPath, int table_id)
{
    QAxObject* selection = m_word->querySubObject("Selection");    
    QAxObject* table = selection->querySubObject(QString("Tables(%1)").arg(table_id).toLocal8Bit());
    QAxObject* range = table->querySubObject("Cell(int, int)", row, column)->querySubObject("Range");


    range->querySubObject("InlineShapes")->dynamicCall("AddPicture(const QString&)",picPath);
}

有人知道吗。
参考微软的资料:
expression.AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)
expression Required. An expression that returns a CanvasShapes object.





AddPicture method as it applies to the InlineShapes object.


Adds a picture to a document. Returns a Shape object that represents the picture and adds it to the InlineShapes collection.

expression.AddPicture(FileName, LinkToFile, SaveWithDocument, Range)
expression Required. An expression that returns an InlineShapes object.




llwj0303 2018-03-26 17:17
楼主最后怎么做的,成功了么?


查看完整版本: [-- QT操作word文档 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled