QT Integration Dsoframer.ocx Open Office Office software

Source: Internet
Author: User

It's been a lot of work lately, a problem with the Office software embedded in the project, not having time to study, and the project's need to browse Word documents, steal a lazy, convert Word documents into PDF documents, and then embed the Libcef browser to open the

Now back to, re-study the direct approach to this area, in the online search for various information, finally decided to use OCX this program to complete this function, can be limited to resource issues, OCX data has not been contacted, so blindly in the evening to see others things, but emperor not negative people, Finally let me succeed in the problem, and then I think, this OCX is still so, generally speaking is relatively simple

My current machine environment: WINDWOS7 64-bit Dsoframer 1.3 qt5.5.1 vs2013

Below I say my own steps:

1. Download Dsoframer.ocx, then use the command to register Regsvr32.exe dsoframer.ocx

2, run Regedit.exe in the HKEY_LOCAL_MACHINE directory search Dsoframer, get the value of CLSID, this is used as the only identifier of the OCX, if not found, you can download other Dsoframer, re-register, or give me a message

3, next directly on the code

1Qaxwidget * _word =NewQaxwidget ( This);2 3_word->setcontrol ("{00460182-9e5e-11d5-b7c8-b8269041dd57}");4 5_word->setproperty ("Visible",true);6 7QString FilePath = Qfiledialog::getopenfilename (0,"Open doc file", QString (),"*.doc");8 9 if(Filepath.isempty ())Ten  One return; A  -_word->dynamiccall ("Open (String)", FilePath); -  the_word->dynamiccall ("setcaption (String)","OCX Test"); -  -_word->dynamiccall ("setmenuaccelerators (BOOL)",false); -  +_word->dynamiccall ("Setmenubar (BOOL)",false); -  +Qgridlayout * ply =NewQgridlayout ( This); A  atPly->addwidget (_word,0,0,1,1); -  -Ply->setcontentsmargins (0,0,0,0); -  -Ui.widget->setlayout (ply);
View Code

As follows:

dsoframer.ocx opening Office software

Dsoframer interface, but there are a few common

Beforedocumentclosed (idispatch*,bool&) document,cancel

Beforedocumentsaved (idispatch*,qstring,bool&) document,location,cancel

Onactivationchange (BOOL) fgoingactive

Ondocumentclosed ()

ondocumentopened (qstring,idispatch*) file,document

Onfilecommand (dsofilecommandtype,bool&) item,cancel

Onprintpreviewexit ()

Onsavecompleted (idispatch*,qstring,qstring) document,docname,fullfilelocation

Exception (int,qstring,qstring,qstring) code,source,disc,help

PropertyChanged (QString) name

Signal (qstring,int,void*) NAME,ARGC,ARGV

Activate ()

Close ()

CreateNew (QString) progidortemplate

Enablefilecommand (dsofilecommandtype) Item bool

Execolecommand (int) Olecmdid

Execolecommand (int,qvariant) olecmdid,options

Execolecommand (int,qvariant,qvariant&) Olecmdid,options,vinparam

Execolecommand (int,qvariant,qvariant&,qvariant&) Olecmdid,options,vinparam,vinoutparam

Getdataobjectcontent (qvariant) Clipformatnameornumber qvariant

Open (qvariant) Document

Open (qvariant,qvariant) document,readonly

Open (qvariant,qvariant,qvariant) document,readonly,progid

Open (qvariant,qvariant,qvariant,qvariant) document,readonly,progid,webusername

Open (qvariant,qvariant,qvariant,qvariant,qvariant) Document,readonly,progid,webusername,webpassword

PrintOut ()

PrintOut (qvariant) promptuser

PrintOut (qvariant,qvariant) promptuser,printername

PrintOut (qvariant,qvariant,qvariant) promptuser,printername,copies

PrintOut (qvariant,qvariant,qvariant,qvariant)

Promptuser,printername,copies,frompage

PrintOut (qvariant,qvariant,qvariant,qvariant,qvariant) promptuser,printername,copies,frompage,topage

PrintOut (qvariant,qvariant,qvariant,qvariant,qvariant,qvariant) Promptuser,printername,copies,frompage,topage, OutputFile

PrintPreview ()

Printpreviewexit ()

Save ()

Save (qvariant) saveasdocument

Save (qvariant,qvariant) saveasdocument,overwriteexisting

Save (qvariant,qvariant,qvariant)

Saveasdocument,overwriteexisting,webusername

Save (qvariant,qvariant,qvariant,qvariant) Saveasdocument,overwriteexisting,webusername,webpassword

Setactivationpolicy (Dsoactivationpolicy) activationpolicy

Setbackcolor (Qcolor) BackColor

setBorderColor (Qcolor) bordercolor

Setborderstyle (Dsoborderstyle) BorderStyle

Setcaption (QString) Caption

Setdataobjectcontent (qvariant,qvariant) Clipformatnameornumber,databytearray

Setenablefilecommand (Dsofilecommandtype,bool) ITEM,RHS

Seteventsenabled (BOOL) eventsenabled

Setforecolor (Qcolor) ForeColor

Setframehookpolicy (Dsoframehookpolicy) framehookpolicy

SetHostName (QString) HostName

Setlockserver (BOOL) lockserver

Setmenuaccelerators (BOOL) menuaccelerators

Setmenubar (BOOL) Menubar setmodalstate (BOOL) modalstate

Settitlebar (BOOL) titlebar

Settitlebarcolor (Qcolor) Titlebarcolor

Settitlebartextcolor (Qcolor) Titlebartextcolor

Settoolbars (BOOL) Toolbars

ShowDialog (Dsoshowdialogtype) Dlgtype

_printoutold ()

_printoutold (qvariant) prompttoselectprinter

If you want to see which method call failed or is an exception, refer to the C + + GUI program additional DOS output window

Note: You can leave a message if you need a complete case

QT Integration Dsoframer.ocx Open Office Office software

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.