QT操作word文档,插入图片(位置跟大小可设)

coder-HRQ 2017-04-24 04:30:21
用QT操作word文档,插入图片,图片在word文档中位置和大小可通过代码设置。
实现插入图片例子:
range->querySubObject("InlineShapes")->dynamicCall("AddPicture(const QString&)",picPath);
如何设置图片大小和位置(新建word)
...全文
3273 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ding一线天 2021-01-30
  • 打赏
  • 举报
回复
请问, nCellImageId这个参数是什么意思
夕阳追脚尖 2020-11-02
  • 打赏
  • 举报
回复
大佬们怎么办,同样的问题
  • 打赏
  • 举报
回复
你解决了没,我也遇到这个问题了
yzj985813717 2020-08-24
  • 打赏
  • 举报
回复
QAxObject* pShape = pInlineShapes->querySubObject("AddPicture(const QString&)",strImageAbsolutePath); pShape->setProperty("Width",40); pShape->setProperty("Height",60); 用了这个不起作用是怎么回事,有没有大神解答一下
coder-HRQ 2017-11-28
  • 打赏
  • 举报
回复
bool QWord::insertCellPic(int nRow, int nColumn, const QString& strPicPath, int nWidth, int nHeight, int nCellImageId, int nTableId) { QAxObject* table = m_document->querySubObject("Tables(int)", nTableId); if (NULL == table) { return false; } QAxObject* range = table->querySubObject("Cell(int, int)", nRow, nColumn)->querySubObject("Range"); if (NULL == range) { return false; } QVariantList params; range->dynamicCall("EndOf(wdCell, wdMove)"); QAxObject* shapes = range->querySubObject("InlineShapes"); QList<QVariant> picList; picList.append(strPicPath); picList.append(false); picList.append(true); shapes->dynamicCall("AddPicture(const QString&, const QVariant&, const QVariant&)", picList); range = table->querySubObject("Cell(int, int)", nRow, nColumn)->querySubObject("Range"); if (NULL == range) { return false; } QAxObject* shape = range->querySubObject("InlineShapes(int)", nCellImageId); if (NULL == shape) { return false; } shape->setProperty("Width", nWidth); shape->setProperty("Height", nHeight); return true; }
雲天之巔 2017-09-08
  • 打赏
  • 举报
回复
像word的这些方法 应该去msdn看。 不然里面有哪些方法 根本不知道: https://msdn.microsoft.com/en-us/vba/word-vba/articles/shapes-object-word
chentao19900828 2017-09-06
  • 打赏
  • 举报
回复 1
QAxObject* pShape = pInlineShapes->querySubObject("AddPicture(const QString&)",strImageAbsolutePath);
pShape->setProperty("Width",40);
pShape->setProperty("Height",60);


一行三甲 2017-08-31
  • 打赏
  • 举报
回复
楼主解决了这个问题没

16,175

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧