Results 1 to 2 of 2
01-09-2010, 03:11 PM #1
newbie questions on generating Word document from ColdFusion
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"
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...e=00000236.htm.
I looked at the example at EasyCFM.COM - ColdFusion Tutorials - ColdFusion Tutorial - ColdFusion Resources - Learn ColdFusion the easy way with our 420+ free coldfusion tutorials! 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 to compile and run it, open a browser and try to open a page http://127.0.0.1:8500/CFIDE/administrator/index.cfm which redirects me to http://127.0.0.1:8500/CFIDE/administ...elloworld.cfm?
I installed the inbuilt web development server which comes with ColdFusion and the server is running. I also installed the JRUN4 as the application I am expected to support, develop used it.
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.
02-02-2010, 11:35 AM #2
I have good news for you. The new ColdFusion CF9 ( Which is Still in Beta ) Has a MS document output and creator built into it. As for the details on how to use it I'm really not quite sure ( I'm still reading the documentation )
In my experience not everyone has MS Word. PDF is a FREE and effective way to have your product. The PDFS that you create are easily editable, and manageable.
By Richaexpert in forum Graphics Design & Web DesignReplies: 25Last Post: 08-10-2011, 01:18 PM
By Abina in forum ColdFusionReplies: 3Last Post: 12-17-2010, 05:42 AM
By wujijiangjun in forum ColdFusionReplies: 8Last Post: 01-05-2010, 09:59 AM