H_C 0 Newbie Poster

I am a complete newbie to ColdFusion and Flex. There was a Flex and Coldfusion developer in our project who left so that work has come to me. My programming background is mainly in C,C++, UNIFACE, PL/SQL with some HTML, JavaScript.

I have a couple of questions and would appreciate if someone could respond to them.

The application I am expected to maintain and enhance prints out reports in PDF format which we need to be in MS-Word format. I have looked at the source for the application and see the below lines in one file

<cfdocument format="pdf" filename="#report_filename_format#" orientation="landscape"
pagetype="legal">

Is there a way to do it in the program so that the output is a MS-Word document? I understand the format attribute can take only "PDF" or "flashpaper" as values as per http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000236.htm.

I looked at the example at http://tutorial13.easycfm.com/ which shows how you can generate a Word document using ColdFusion.

The first time I ran it it worked well and a word document called Hello.doc was created. The next time, I changed the text to be printed in the Word document from "Hello World" to "Hello World again" it did not and I got the error message "Error Occurred While Processing Request
The SaveAs method was not found. There are no methods with the specified method name and argument types. Check your function and try again.
"

I understand the first time, there was no Word document application object so it was created and the text was written to it properly. The next time, ColdFusion is trying to connect to the Word application object which exists, but somehow it is failing. I changed the name of Word file to be written from Hello.doc to Hello123.doc, but it still did not work. I have permissions to write in the directory where the Word file is being created which is why the example ran fine the first time.

The way I am running this example is typing code in a file called helloworld.cfm which is present in my C:\ColdFusion8\wwwroot\CFIDE\administrator\ directory using Editplus editor, then opening a browser and trying to open a page http://127.0.0.1:8500/CFIDE/administrator/index.cfm?target=/CFIDE/administrator/helloworld.cfm?

1. Is this the proper method?

2. Can someone please clarify where I might be erring in running this example and how can I fix it?

3. Is there an easier way to get the output from ColdFusion in MS-Word format than what I am doing?

Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.