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.
|
|