Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

can you amend Word docs using CF?

Participant ,
Aug 05, 2008 Aug 05, 2008
hi there,

i have a load of word documents (.doc / docx) on my server

i want to do the following:

1 read each document to find any instances of an email address contained within (will use Regex for that i guess)
2 replace each email address with "---there was an email address here and the server has removed it---"
3 save the new (amended) word document

Does CF 8 have any new clevernesses to help me out here?

I suspect I may have to read the contents of the word doc into memory, make my changes there and then create a new word doc (using cfdocument?) with my amended content that is now in memory.

If anyone has any comments / suggestions to help me avoid any dead-ends i'd be ever so grateful.

Thanks very much indeed.
TOPICS
Advanced techniques
332
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 05, 2008 Aug 05, 2008
LATEST
If you have MS Office installed on the server then you could use the filesystem object and COM to manipulate the files.

If you don't have that installed then you could possibly look into using Apache's POI-HWPF(just google apache+poi+hwpf). I recently used it to extract the text from a Word document but I'm not sure about it's Word document creation/save as functionality.

Check out this post if you decide to go the POI route because CF 8 comes with a preinstalled version of POI 2.5 that does not include the HWPF classes.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources