GithubHelp home page GithubHelp logo

pedrolcl / qtword Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 42 KB

ActiveQt Word Automation sample

License: BSD 3-Clause "New" or "Revised" License

C++ 70.07% QMake 29.93%
activeqt automation ms-word

qtword's Introduction

ActiveQt Word Automation sample

I've found this question on StackOverflow requesting advice for creating a Word document from scratch (as opposed to opening / modifying) an existing one, from a Qt application. The user wants to use raw QAxObjects and dynamicCall() to do so, in line with other answers on the same site, but I know that there is a better way of automating Office applications: importing the object model from the MS Word COM type library into the C++ project. This is a sample template of the proposal, that is very similar to the Qutlook Example for the Outlook application. You can extrapolate the technique to Excel and PowerPoint if you want.

It is a command line project with only two files: the Qmake project file and 'main.cpp'. The project file uses the utility dumpcpp.exe to generate the header and source files from the type library.

DUMPCPP=$$absolute_path("dumpcpp.exe", $$dirname(QMAKE_QMAKE))
TYPELIBS = $$system($$DUMPCPP -getfile {00020905-0000-0000-C000-000000000046})

To obtain the Guid of a type library, you may want to use the 'oleview.exe' utility to explore the libraries installed in your Windows box.

oleview.exe image

The main() function #includes the generated header "MSWORD.h", creates a new document, populates its contents with two text lines, and saves this document twice: the first time in the modern DOCX format, and again in the DOC format compatible with Word 97/2003.

qtword's People

Contributors

pedrolcl avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

oamates

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.