查看完整版本: [-- QAxBase: Error calling IDispatch member Open: Exception thrown by server --]

QTCN开发网 -> Qt基础编程 -> QAxBase: Error calling IDispatch member Open: Exception thrown by server [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

lgs_shandong 2017-09-23 15:23

QAxBase: Error calling IDispatch member Open: Exception thrown by server

在使用QAxObject打开xlsx文件时,程序运行到语句:
QAxObject *work_books->dynamicCall("Open(const QString&)", strFile.toLocal8Bit());
时出现调试错误,如下:

QAxBase: Error calling IDispatch member Open: Exception thrown by server
             Code       : 1004
             Source     : Microsoft Excel
             Description: ??????? test.xlsx????????????????
             Help       : xlmain11.chm
         Connect to the exception(int,QString,QString,QString) signal to catch this exception
运行到下面的语句时:

QAxObject *first_sheet = work_sheets->querySubObject("Item(int)", 1);
first_sheet->dynamicCall("delete");
错误提示如:

QAxBase: Error calling IDispatch member delete: Exception thrown by server
             Code       : 1004
             Source     : Microsoft Excel
             Description: ????????????????

????????????????????????????????????????????
             Help       : xlmain11.chm
         Connect to the exception(int,QString,QString,QString) signal to catch this exception
但程序能运行,而且创建了文件,但使用下面的语句创建的文件名不对:
work_book->dynamicCall("Save()")
变量strFile = “test.xlsx”;
最终保存的文件名为:Sheet1.xlsx。
有人知道为什么?

aimybbe 2017-09-23 20:55
我也有相同的问题哎。使用天池里面的操作excle时出现的,excel装的是office2016


查看完整版本: [-- QAxBase: Error calling IDispatch member Open: Exception thrown by server --] [-- top --]



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