Follow on Google News News By Tag Industry News News By Place Country(s) Industry News
Follow on Google News | Convert HTML table to Excel spreadsheet without saving on serverElerium HTML to Excel .NET component, new release 1.5 has been introduced by Elerium Software
By: Elerium Software Elerium HTML to Excel .NET component, new release 1.5 has been introduced by Elerium Software. It has several important changes: - Extended the parser list of CSS styles. - Fixed bugs in Merged Cells. - The algorithm was tested & optimized for big HTML tables. How to use the component? First of all, a developer must install component to the project: 1. Add Elerium Excel .Net component to the solution. Simply put HtmlToExcel.dll into /bin folder of the project. 2. Initialize the Docs.HTML, Docs.Excel and Docs.Excel.Converting instance. When the component is connected to the project a developer can convert HTML document to Excel spreadsheet and save it as a file or memory stream. The saving to memory stream is very convenient if is necessary to send the resulting file to the user without saving it on the server. This example shows how to convert HTML document to Excel as a memory stream: C# code: // Read the specified html file. HtmlDoc html = HtmlDoc.ReadHTML(@" // Convert Html table to Excel HtmlToExcel htmlexcel = new HtmlToExcel(); ExcelWorkbook excel = htmlexcel.Convert( //Add text and save Excel file to Memory stream. excel.Worksheets[ MemoryStream mstream = excel.WriteXLSX(); Let’s consider the practical application. Send the resulting file to the user into the browser window: C# code: // Read the specified html file. HtmlDoc html = HtmlDoc.ReadHTML(@" // Convert Html table to Excel HtmlToExcel htmlexcel = new HtmlToExcel(); ExcelWorkbook excel = htmlexcel.Convert( // XLS // Save Excel Workbook (XLS) to MemoryStream byte[] bytes = excel.WriteXLS() // Show Excel (XLS) in Browser window without saving on disk Response.ContentType = "application/ Response.BinaryWrite( Response.Flush(); Response.End(); // XLSX // Save Excel Workbook (XLSX) to MemoryStream byte[] bytes = excel.WriteXLSX() // Show Excel (XLSX) in Browser window without saving on disk Response.ContentType = "application/ Response.BinaryWrite( Response.Flush(); Response.End(); Also the professional version of the component allows to edit the Excel file before saving: C# code: / Read the specified html file HtmlDoc html = HtmlDoc.ReadHTML(@" // Convert Html table to Excel HtmlToExcel htmlexcel = new HtmlToExcel(); ExcelWorkbook excel = htmlexcel.Convert( // Change font style of first column excel.Worksheets[ // Save Excel file as XLSX MemoryStream mstream = excel.WriteXLSX(); About Elerium Software Elerium Software develops professional solutions for use in .NET projects (C#, VB.NET, ASP.NET) that aimed to read/write/convert different office/web documents and formats. Elerium Software components are based on the unique design and fast algorithms that allow being independent from the third-party applications and libraries. For more information about the component please visit the product page: http://eleriumsoft.com/ End
Account Email Address Account Phone Number Disclaimer Report Abuse
|
|