2

要从单元格中读取文本,我使用以下命令:

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

4

1 回答 1

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");
于 2013-04-24T13:13:28.630 回答