Skip to main content
Participant
Jul 20, 2021 3:03 PM UTC
Question

Open a Word Document with CF

Is there a way I can OPEN an MS Word document with CF? I don't want to CREATE one, but only open one that exists already (then let its Autoexec function do a whole lot of stuff with the document).

 

Thanks. -Dale

    This topic is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    dcoppsAuthor
    Participant
    Jul 21, 2021 11:13 AM UTC
    Thanks for the response. I don't actually want to open a Word document in Coldfusion. I want Coldfusion to launch MS Word and load a specified document/file. Word will then take over processing the document's Autoexec macro. I don't think what I want is actually do-able in CF, but I want to confirm that.

    Thanks again.
    -----------------------------------------------
    Dale Copps, Library Manager
    Creare LLC, 16 Great Hollow Road
    Hanover, NH 03755
    603 640-2384 fax: 603 643-4657
    dgc@creare.com www.creare.com
    -----------------------------------------------
    Translate
    BKBK
    Community Expert
    Community Expert
    Jul 24, 2021 8:28 PM UTC

    You could try something like:

    <cfexecute name="C:\Windows\System32\cmd.exe"

                      arguments="/c absolute-path-to-winword.exe absolute-path-to-SampleWordDoc.docx">
    </cfexecute>

    Translate
    BKBK
    Community Expert
    Community Expert
    Jul 20, 2021 9:42 PM UTC

    Yes, but it all depends on what you want ColdFusion to do with the .doc or .docx file. You can open an MS Word document in ColdFusion. In ColdFusion, rather than with ColdFusion. So, don't expect ColdFusion to run macros.

     

    In ColdFusion, you could then use the Apache POI library, for example, to process MS Word documents. That is what Raymond Camden did over 10 years ago.

    https://www.raymondcamden.com/2009/02/04/Reading-Office-documents-with-ColdFusion

     

    Translate