c++ - qt open excel name passing error -
now making 1 programme reads 2 excel sheets , makes one.
and fine. have 1 problem
that is
qaxwidget *excel=new qaxwidget("excel.application", this); excel->dynamiccall("setvisible", true); qaxobject *workbooks=excel->querysubobject("workbooks"); workbooks->dynamiccall("open(const qstring&)", qstring(":/temp/temp.xls")); qaxobject *workbook=excel->querysubobject("activeworkbook"); qaxobject *worksheets=workbook->querysubobject("worksheets");
my qrc file
<rcc> <qresource prefix="/"> <file>temp/temp.xls</file> </qresource> </rcc>
workbooks->dynamiccall("open(const qstring&)", qstring(":/temp/temp.xls")); part occurs error
i inserted 1 excel template file resource.qrc
and tried open didn't work.
if passed absolute path of file, work. if passed relative path of file, don't work
how can solve this?? please allow me know.. thanks
you can set excel file in directory within project docs or something.
set current directory qdir::setcurrent(qcoreapplication::applicationdirpath())
you can access files within doc folder "docs/anyfile.xls"
if set xls file within resources bundled within executable , won't accessible microsoft office com components.
c++ excel qt
No comments:
Post a Comment