Getting Microsoft Word Object to SaveAs
-
#include <QtGui>
-
#include <QAxObject>
-
#include <QAxWidget>
-
-
int main(int argc, char **argv)
-
{
-
-
-
-
word.setProperty("Visible", true);
-
QAxObject * documents = word.querySubObject("Documents");
-
documents->dynamicCall("Add (void)");
-
QAxObject * document = word.querySubObject("ActiveDocument");
-
-
document
->dynamicCall("SaveAs (const QString&)", QString("e:/test/docbyqt.doc"));
-
document->dynamicCall("Close (boolean)", false);
-
word.dynamicCall("Quit (void)");
-
return 0;
-
}
Getting Microsoft Word Object to SaveAs
-
//Start Word
-
my_app
= new QAxObject("Word.Application", this);
-
QAxObject* my_docs = my_app->querySubObject("Documents");
-
-
//Open newDocName
-
-
-
-
-
-
-
-
QAxObject* doc = my_docs->querySubObject("Open(const QVariant&, const QVariant&,const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)", filename,confirmconversions, readonly, addtorecentfiles, passworddocument, passwordtemplate, revert);
-
-
//Pull out active document object
-
QAxObject* active_doc = my_app->querySubObject("ActiveDocument");
-
-
-
QVariant fileFormat
(10); //Saving as filtered html
-
-
-
-
-
-
-
active_doc->querySubObject("SaveAs(const QVariant&, const QVariant&,const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)", newFileName, fileFormat, LockComments, Password, recent, writePassword, ReadOnlyRecommended);