要从单元格中读取文本,请使用:
QAxObject *e = new QAxObject("Excel.Application");
QAxObject *wbooks = e->querySubObject("Workbooks");
QAxObject *wbook = wbooks->querySubObject("Open(const QString&)", "somefile.xls");
QAxObject *s = wbook->querySubObject("Worksheets(int)", 1);
QVariant v = s->querySubObject("Cells(int,int)", 2, 2)->property("Value");
// v = "sometext"
但是如何从单元格读取超链接地址?
Qt 5.0.1 Windows 7
答案 0 :(得分:0)
尝试:
QAxObject *e = new QAxObject("Excel.Application");
QAxObject *wbooks = e->querySubObject("Workbooks");
QAxObject *wbook = wbooks->querySubObject("Open(const QString&)", "somefile.xls");
QAxObject *s = wbook->querySubObject("Worksheets(int)", 1);
QVariant v = s->querySubObject("Cells(int,int)", 2, 2)->querySubObject("Hyperlinks(int)", 1)->property("Address");