Help displaying .doc format files in Qt application.
Hello,
As Its written in title, I want to display .doc file content in Qt application window. I read that QTextBrowser is opening only plain txt and html files.
Anyone have ideas how can I display doc files( MS Word 97-2000 files ) ? It's a part of my project and I dont have any idea how to get into it....
Any help would be appreciated,
notes.
Re: Help displaying .doc format files in Qt application.
Embed Microsoft Word using ActiveX.
Re: Help displaying .doc format files in Qt application.
Quote:
Originally Posted by
ChrisW67
Embed Microsoft Word using ActiveX.
Any idea where to read about activeX in Qt ? Is there any tutorial or documentation out there ?
I found only this :http://doc.qt.digia.com/qt-maemo/activeqt.html
which didn't help a lot :(
Re: Help displaying .doc format files in Qt application.
You might find some useful information here or here. These examples are .NET based, but you should be able to substitute the Qt ActiveX container and ActiveX QWidget for the similar .NET container and window.
Re: Help displaying .doc format files in Qt application.
I've looked into QAxObjects and came up with this piece of code that opens ms word .doc file...
Code:
#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;
}
Now I can't find where I can list off all commands I can use while writing
Code:
querySubObject("Parameter()");
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...
Code:
#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;
}
Now I can't find where I can list off all commands I can use while writing
Code:
querySubObject("Parameter()");
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 :
Code:
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 ();
}
And that is all... 4 lines of code... Qt is amazing :D