HTML to Word or PDF to Word
Copy link to clipboard
Copied
Thanks
Paul
Copy link to clipboard
Copied
Some ideas to generate a word document:
- write html code after <cfcontent type="application/msword">, the easy way
- Use the HWPF Java Classes of the Apache POI Project. I don't know if there is a Coldfusion Component to handle that. I found one to generate Excel Sheets with Apache POI that is really great: http://www.bennadel.com/projects/poi-utility.htm
- Generate the word doc using com objects: http://tutorial13.easycfm.com/
I hope this helps...
Copy link to clipboard
Copied
I have tried one of the Java components from Aspose before.
Aspose.Word
http://www.aspose.com/categories/file-format-components/aspose.words-for-.net-and-java/default.aspx
But this is a bit complex process if you need to generate all from CF.
I also would suggest to check WordML technology. Documentation is a real pain but it is just basically a XML syntax which enables to generate Word files onfly.
Here is a nice guide for WordML
http://rep.oio.dk/Microsoft.com/officeschemas/wordprocessingml_article.htm
Copy link to clipboard
Copied
This component can convert HTML to Word:http://www.sautinsoft.com/products/html-to-rtf/index.php
This is a sample code:
SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
//here we specify page numbers
h.PageNumbers = SautinSoft.HtmlToRtf.ePageNumbers.PageNumFirst;
h.HtmlPath = Server.MapPath("");
string rtf = h.ConvertFileToString(Server.MapPath(""), @Default.aspx);
//show Word/rtf
if (rtf != "")
{
Response.Buffer = true;
Response.Clear();
Response.ContentType = "aplication/msword";
Response.AddHeader("Content-Disposition:", "attachment; filename=Test.doc");
Response.Write(rtf);
Response.Flush();
Response.End();
}
Or another sample to convert in memory:
SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
string word = h.ConvertString(htmlString);
- Written in 100% managed C#
- Absolutely standalone, doesn't require MS Office or any dependencies
- Can be used in C#, VB.Net, J#, Delphi.Net, ColdFusion
- Works at shared-hosting servers with Medium trust level, like a GoDaddy
Download complete functional trial: http://www.sautinsoft.com/components/htmltortf_pro_net.zip
Best wishes,
Max

