有关Qt QAxWidget读取word 的问题
一夜了 2016-03-02 09:15:10 QAxWidget *word = new QAxWidget("Word.Application");
//word->setControl("{00460182-9E5E-11d5-B7C8-B8269041DD57}");
word->setProperty("Visible",true);
QAxObject *documents = word->querySubObject("Documents");
//QAxObject *documents;
//documents->dynamicCall("Add");
//documents->setControl("MSCal.Calendar");
//documents->dynamicCall("Add(QString)",QString::fromLocal8Bit("D:/template.dot"));
//documents->dynamicCall("Add (void)");
//documents->dynamicCall("Open(const QString&)",QString("D:/template.doc"));
documents->dynamicCall("Open(const QString&)", QString("D:/template.doc"));
QAxObject *document = word->querySubObject("ActiveDocument");
document->dynamicCall("SaveAs (const QString&)",QString("D:/template.docx"));
document->dynamicCall("Close (boolean)",false);
运行的时候documents->dynamicCall("Open(const QString&)", QString("D:/template.doc"));这段代码总是出现内存问题。我看了一下好像是documents指针为空,不知道为什么??