PDA

View Full Version : DOCX,PPTX and XLSX file preview in Qt



santosh.kumar
5th November 2016, 10:20
Hi

I am using Qt 4.8.7 Static on Windows Platform. I want to show preview DOCX,PPTX and XLSX file preview.

Is there any way to show preview...I am using following code



///for Powerpoint
QAxWidget *m_pAxDocument = new QAxWidget("PowerPoint.Application",m_pTextEdit);
m_pAxDocument->setGeometry(m_pTextEdit->geometry());
m_pAxDocument->setProperty("DisplayAlerts",false);

QAxObject *axObject = m_pAxDocument->querySubObject("Presentations");
QAxObject *present = axObject->querySubObject("Open(const QVariant&)",QVariant(strFileName));


for DOCX


m_pAxDocument = new QAxWidget("Word.Document",m_pTextEdit);
m_pAxDocument->setGeometry(m_pTextEdit->geometry());
m_pAxDocument->setProperty("DisplayAlerts",false);
m_pAxDocument->setControl(strFileName))

It show preview but it is editable, it directly open in MS Word or powerpoint and you can do anything with its preview...cut, copy paste.

I want it to make preview using QAxWidget readable only...Is there any method for this...I am also unable to disable the QAxWidget/QTextEdit.. I don't have control on this preview...

Or any other way to show DOCX,PPTX and XLSX file preview in Qt.

Kindly reply..

Thanks
Santosh

d_stranz
5th November 2016, 15:48
Is there a "setProperty" call for a read-only property?

santosh.kumar
5th November 2016, 16:26
I don't know whether readonly property or not. Kindly tell me whether disable qaxwidget or readonly it. I didn't find any documentation regarding preview of office files. I will codetags# after 1 days, I may accessing through mobile.

If anybody know this solution kindly help me.
Thanks for reply.

santosh.kumar
7th November 2016, 08:23
If anybody know this solution kindly help me.

santosh.kumar
7th November 2016, 11:29
Hi

Anybody know if docx,pptx, xlsx convert into HTML format.

Thanks
Santosh

d_stranz
7th November 2016, 17:57
I don't know whether readonly property or not. Kindly tell me whether disable qaxwidget or readonly it.

QAxWidget is simply a container where ActiveX controls can display their content. It has no concept of "read-only". You need to look at the Microsoft documentation for your ActiveX controls to find out if they support a read-only property on their documents.


Anybody know if docx,pptx, xlsx convert into HTML format.

Again, you need to look at the Microsoft documentation. I doubt if you can convert documents in these formats into the subset of HTML that Qt supports; you will almost certainly end up with HTML that cannot be rendered by Qt. You will be much better off if you read the Microsoft ActiveX documentation for these document types and learn how to display them in QAxWidget with a read-only property.