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.
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.
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.
^ _ ^
I tried modifying the xml by just changing a word in the source data. When I saved it and tried to open it, Word could not open the file.
I've been looking around, and I have yet to see anything Word related that CF can work well with. I know for a fact that CFSPREADSHEET and SpreadsheetNew() work most excellent with Excel files, but I've never needed to work with Word files.
I know CFDOCUMENT can convert .doc/.docx files to PDF. Would that suffice? Convert the Word file to PDF, then manipulate the PDF and serve that to the user?
^ _ ^
Thanks for looking. I looked myself and could not find a ColdFusion example.
I agree that the ColdFusion spreadsheet functions are really good.
What I need to do, is generate a Word template pre-filled with db data that users will then manipulate. That is why it needs to be in Word.
cfdocument or cfhtmltopdf would do the trick if there was an easy way to convert the pdf to word after the pdf was generated.
Not in CF, AFAIK. You might find some third party application that can do that, use DirectoryWatch to kick off the process once the PDF has been saved to a particular folder, perhaps.
^ _ ^