We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Coldfusion document generation

I am evaluating Aspose Words as a Word Document generator for a project I am currently working on.

The project is a ColdFusion application. This post is more of a general inquiry than a specific question. Hopefully, your response will assist other ColdFusion developers who are also evaluating your product.

Here is what I need to do. I have a fairly complex word document (~30 pages with images, all kinds of crazy formatting...) and I need to be able to use that as a report template (need to create/fill in tables with specific data, and do other types of find/replace procedures). I'm new to Java and I know that ColdFusion can create java objects.

From reading your documentation, it looks like what I need to do is put the document on my server, load it, clone the document, and then use document builder to insert the custom content I need.

What I'm looking for here are two things:

  • More examples of how to integrate Aspose Words into ColdFusion... Looks like you have a solid product here and there are plenty of ColdFusion developers who are not strong Java developers... Evidently there were some inaccessable attachments on previous posts which supposedly had ColdFusion code
  • How do I setup the document as a stream. I am going to have hundreds of these templates generated. I have no reason to keep each one of them on my server.

From the exhaustive search I've done on generating Word Documents without the dreadful Office Automation, your product appears to be the best option. I need to be able to generate one of these reports in order to show proof of concept so that I can proceed with the procurement procedure.

Thanks. Also, I am not allowed to use .NET at all in my application's production environment.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your interest in Aspose.Words. I think, in your case the best way to fill the template with data is Mail Merge. Please following the link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/simple-mail-merge-explained.html

In Coldfusion you can use both .NET and Java versions of Aspose.Words. I attached two documents that describe both approaches. Hope this information could be useful for you.

Best regards,

Hi Alexey,

Thanks for your speedy response. The mail merge does look like a good option the case of this project.

One more question: I did not see this explained in the documentation you attached, and I'm not sure how to do it. This would be a requirement before buying Aspose Words.

I need to be able to stream the generated documents to a web browser. I have no real reason to store them on the disk, as there are so many of them and all results would be in the database anyway.

I know coldfusion has a cfheader and cfcontent tag. Would these integrate with Java? How can I stream to the web browser directly from memory?

Thanks! This is a great product!

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I do not have much experience in Coldfusion. But I think, it is possible to achieve what you need. Here is useful discussion:

http://forums.devshed.com/coldfusion-development-84/coldfusion-and-binary-data-127322.html

In your case, I think, you should do the following:

1. Get data from your Data Source as byte array.

2. Create ByteArrayInputStream and init it with byte array from your data source.

3. Create a Document object and init it with created stream. There is an overload of Document constructor, which takes InputStream as an input parameter:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/document.html#Document(java.io.InputStream)

4. Execute Mail Merge as described in the document I Attached in my previous answer.

5. Create ByteArrayOutputStream and init it with no parameters.

6. Save document into the created OutputStream. There is an overload of save method which takes OuputStream and SaveForamt as parameters:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/document.html#save(java.io.OutputStream, int)

7. Get byte array from ByteArrayOutputStream, there is toByteArray method.

8. Send byte array to the client’s browser.

Hope this helps.

Best regards,

Hi Alexey,

Thanks for all the valuable information. I've been able to create a proof-of-concept. Aspose words is such an elegant solution.

Also, for your information, a coldfusion query object is basically a java resultset and it can be used directly in executeWithRegions. This makes it even easier for ColdFusion programmers to use your product.

Hi Andrew,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for those kind words. It is nice that you successfully finished evaluation of Aspose.Words. Please feel free to ask in case of any issues, I will be glad to help you.

Best regards,