I've looked into QAxObjects and came up with this piece of code that opens ms word .doc file...
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
word->setProperty("DisplayAlerts", false);
QAxObject* document
= word
->querySubObject
("Documents()");
document->querySubObject("Open(const QString&)", "D:\\Qt\\ProjektInzOp\\AlaMaKota.doc");
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QAxObject* word = new QAxObject("Word.Application",this);
word->setProperty("DisplayAlerts", false);
QAxObject* document = word->querySubObject("Documents()");
document->querySubObject("Open(const QString&)", "D:\\Qt\\ProjektInzOp\\AlaMaKota.doc");
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
Now I can't find where I can list off all commands I can use while writing
querySubObject("Parameter()");
querySubObject("Parameter()");
To copy to clipboard, switch view to plain text mode
That list would help me a lot with planning how to get text, picutres ect.
I've looked into QAxObjects and came up with this piece of code that opens ms word .doc file...
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
word->setProperty("DisplayAlerts", false);
QAxObject* document
= word
->querySubObject
("Documents()");
document->querySubObject("Open(const QString&)", "D:\\Qt\\ProjektInzOp\\AlaMaKota.doc");
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QAxObject* word = new QAxObject("Word.Application",this);
word->setProperty("DisplayAlerts", false);
QAxObject* document = word->querySubObject("Documents()");
document->querySubObject("Open(const QString&)", "D:\\Qt\\ProjektInzOp\\AlaMaKota.doc");
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
Now I can't find where I can list off all commands I can use while writing
querySubObject("Parameter()");
querySubObject("Parameter()");
To copy to clipboard, switch view to plain text mode
That list would help me a lot with planning how to get text, picutres ect.
Added after 1 17 minutes:
Ok... Problem has been solved, thanks for help everyone
Solution was very simple :
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
WordDocument
-> setGeometry
(QRect (10,
10,
621,
471));
WordDocument->setControl ("D:\\Qt\\ProjektInzOp\\AlaMaKota.doc");
WordDocument-> show ();
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QAxWidget* WordDocument=new QAxWidget ("Word.Document", this-> ui-> textEdit);
WordDocument-> setGeometry (QRect (10, 10, 621, 471));
WordDocument->setControl ("D:\\Qt\\ProjektInzOp\\AlaMaKota.doc");
WordDocument-> show ();
}
To copy to clipboard, switch view to plain text mode
And that is all... 4 lines of code... Qt is amazing
Bookmarks