Converting HTML File to Excel File and XML File using c# Code
-
Hi, Can any one suggest me how to convert HTML file to Excel and Pdf . In C# Code only I have html file i want 2 generate that file to Excel and PDF
There's a lot of different approaches. You could use an XSLT transformation, assuming the HTML is well-formed. (example: http://ewbi.blogs.com/develops/2005/01/create_excels_s.html[^]). For pdf's, you'd probably be converting to XSL-FO, then using a converter to pdf (example and information: http://html2fo.sourceforge.net/[^]; http://www.ibm.com/developerworks/library/x-xslfo2app/[^]) You could use 3rd party components to do the creation/conversion. (XL example: http://www.gemboxsoftware.com/GBSpreadsheetFree.htm[^]; pdf example: 100% .NET component for rendering PDF documents[^]) You could try a more targeted programmatic approach to create the output directly, if you didn't need a full-featured 3rd party component. Try a Google search for something like "html to excel c#" for a bunch of examples. You could also, at least for the XL side, use interop. (example: http://support.microsoft.com/kb/302084[^]) I think the approach you use ultimately depends on the specifics of your situation, and how much complexity in the excel/pdf document you need to support.