Using Word as an embedded editor

Posted on 2004-11-21
Last Modified: 2010-04-05
I want to create and edit Word documents from "inside" a Delphi app .. RichEdit/RTF will not suffice because I need to retain the style names .. the name that comes up in the drop down list box in Word.

OK, so I need Word as an "embedded editor". There is various automation stuff around re starting Word, but I would like to start it as if it was in a window that I controlled - I want it to start in a smallish window near where I click on a node in a treeview.

any clues?

Then to make it more interesting, I want to be notified if the user has saved or closed that document.  I would prefer to control how they save it and whether they can close it, but being notified would suffice.

Question by:Mutley2003
    LVL 17

    Accepted Solution


    One option could be to use OleContainer (from System tab):

    // ocMain is a TOleContainer
     ocMain.CreateObjectFromFile('c:\test.doc', False);

    then you can use the OleObject, which holds the dispatch interface to call the SaveAs method.

    For example:

     // Save document as "c:\test.doc"

    Regards, Geo

    Author Comment

    Geo, that works great,
    thanks very much
    LVL 17

    Expert Comment

    You are welcome :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now