查看完整版本: [-- Qt5 导入图片到excel问题。。在线等,急。。。。 --]

QTCN开发网 -> Qt基础编程 -> Qt5 导入图片到excel问题。。在线等,急。。。。 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

kavieen 2017-01-18 10:45

Qt5 导入图片到excel问题。。在线等,急。。。。

QString strImagePath = QDir::toNativeSeparators(bmpPath);              QImage image(strImagePath);
              QAxObject * shapes = worksheet->querySubObject("Shapes");              shapes->dynamicCall("AddPicture( QString&, bool, bool, double, double, double, double",strImagePath,false,true,1,1, image.width(),image.height());请问大侠们,这样导入图片为什么会报错呢?查了查资料也没发现问题。。。。,在线等,急。。。。。
QAxBase: Error calling IDispatch member AddPicture: Exception thrown by server
             Code       : 1004
             Source     :
             Description:
             Help       :
         Connect to the exception(int,QString,QString,QString) signal to catch this exception

alexltr 2017-01-18 21:50
可能是数据类型不对, 可以在excel-vba里了解一下

[attachment=16361]


  1. QAxObject *shapes = sheet->querySubObject("Shapes");
        shapes->dynamicCall("AddPicture(const QString&, single, single, single, single, single, single)",
                            pictureFileName, 0, 1, left+(width-width*0.88)/2.0, top+edgeSpacing,
                            width*0.88, height-edgeSpacing*2);



查看完整版本: [-- Qt5 导入图片到excel问题。。在线等,急。。。。 --] [-- top --]



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