Skip to main content
Participant
July 20, 2021
Question

Open a Word Document with CF

  • July 20, 2021
  • 2 replies
  • 986 views

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 has been closed for replies.

    2 replies

    dcoppsAuthor
    Participant
    July 21, 2021
    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
    -----------------------------------------------
    BKBK
    Community Expert
    Community Expert
    July 24, 2021

    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>

    BKBK
    Community Expert
    Community Expert
    July 20, 2021

    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