0

I am working on a small project where I have to read more than 100 MS Word files and loop through each file and update their headers and footers. I want to accomplish this task in ColdFusion 10/11.

Is there any way I can get this done in ColdFusion?

user3071284
  • 6,955
  • 6
  • 43
  • 57
Ronnie Kumar
  • 635
  • 5
  • 18
  • What was your google search string? – Dan Bracuk May 09 '14 at 14:33
  • 2
    What have you already tried? Which version of Word? If you're dealing with `.docx` files those are just XML and you should be able to manipulate them fairly easily. – Fish Below the Ice May 09 '14 at 16:12
  • on google I found, this can be done using COM .Net integration with CF. And call that class using . However, it seems like a lot of work and I don't have knowledge of .NET. – Ronnie Kumar May 09 '14 at 18:00
  • 1
    @3524344 They are ZIPs of multiple XML files. I suppose one unzip the file, change the data file via CF XML functions and re-zip the files. I would be concerned that some issue would get introduced that would make them un readable. – James A Mohler May 09 '14 at 21:45
  • 1
    Aspose.com makes a number of products for helping with interacting with MS files. I have only used their Java based products for interacting with Excel files via making the calls to those libraries through CF code. They even have a link for showing how to create Word headers/footers via Java: http://www.aspose.com/docs/display/wordsjava/How+to++Create+Headers+Footers+using+DocumentBuilder Might be a good starting point to work towards a proof of concept with. – Snipe656 May 12 '14 at 18:22
  • You are welcome. Guess I should made it an answer instead of a comment ;) If you have trouble getting their classes to load then search their forums. Pretty sure I posted there how I got them to load for a couple different versions of CF – Snipe656 May 14 '14 at 20:26
  • @Snipe656 - You can still do that. It would certainly be helpful to have an example of using Aspose from CF in the archives. @ Ronnie777 - For the benefit of others, could you elaborate on exactly how you used the tool in selected answer to manipulate the headers/footers? – Leigh May 16 '14 at 15:14

2 Answers2

0

The <cfdirectory> tag can be used to work with files in a directory, for example getting a list to process using <cfloop>.

ColdFusion does have some support for MS Office files. What you're trying to do can be done for an Excel spreadsheet, reading the file with <cfspreadsheet> and then using functions such as SpreadsheetSetFooter(), before writing the file.

However, there are no comparable functions for Word files!

Adobe ColdFusion documentation

Simon Fermor
  • 116
  • 1
  • 11
0

RIA Forge has a tool called

http://docxextractor.riaforge.org/

Which pulls data from docx files. It does not create docx files however

Disclaimer: I wrote this

James A Mohler
  • 11,060
  • 15
  • 46
  • 72