Skip to main content
Inspiring
February 13, 2019
Question

Replace text in word document

  • February 13, 2019
  • 1 reply
  • 875 views

Using a recent version of ColdFusion that has the built in POI library, using HWPF or XWPF (it does not matter which one), does anyone have sample code that would read a word file from the server, replace text (for example: replace "*test*" with "12345") and then output this new version of the file to the browser? No need to save the file. Pushing the new file data via cfcontent is what I am looking for.

Any help would be appreciated. Thank you in advance.

    This topic has been closed for replies.

    1 reply

    WolfShade
    Legend
    February 13, 2019

    Someone in the CF Community posted something that you might want to read.

    https://coldfusion.adobe.com/2018/11/extracting-text-html-out-word-docx-files/

    HTH,

    ^ _ ^

    Inspiring
    February 13, 2019

    Thank you for this. I watched the video, but this is not really what I need.

    I need to edit a Word document and then push it to the browser in Word format (doc or docx). The video explains how to convert a Word document into xml format and display in a browser.

    WolfShade
    Legend
    February 13, 2019

    But you can take that XML, modify it, save it to a variable and produce it to the browser.

    Well, maybe I'm over-simplifying it, but that was the thought that was in my head.

    V/r,

    ^ _ ^