I am working with QAxObjects to access Microsoft Word and can open and manipulate files but am struggling to get the SaveAs method to work. Does anyone out there have a working example they would be prepared to share?
Thank you
Printable View
I am working with QAxObjects to access Microsoft Word and can open and manipulate files but am struggling to get the SaveAs method to work. Does anyone out there have a working example they would be prepared to share?
Thank you
I suppose not that many people on this forum are using ActiveQt since it's only part of commercial Qt/Win. But perhaps we can help if you attach the generated C++ header (dumpcpp) and paste some code what you've tried so far.
Hi,
this seems to work here.
HTH, Bernd
--
Code:
#include <QtGui> #include <QAxObject> #include <QAxWidget> int main(int argc, char **argv) { word.setProperty("Visible", true); documents->dynamicCall("Add (void)"); document->dynamicCall("Close (boolean)", false); word.dynamicCall("Quit (void)"); return 0; }
Thanks for the help. As a further complication I needed to save in Word's filtered html format. The following code seems to work.
Code:
//Start Word //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 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);