1. Tag Results
save_as_.xls (4)
1 - 4 of 4
How to avoid file corruption while opening the generated file using XlsIO in .NET MVC web application ?
XlsIO generated files will be downloaded in .xls format in some browsers by default, even when we add the extension in the file name or set the version for the file. Because of this the downloaded file gets corrupted. To overcome this, set ExcelHttpContentType while saving the file in XlsIO.   Below code snippet demonstrates on how to set ExcelHttpContentType while saving .xlsx format file using XlsIO. C# // Step 1 : Instantiate the spreadsheet creation engine. ExcelEngine excelEngine = new ExcelEngine(); // Step 2 : Instantiate the Excel application object. IApplication application = excelEngine.Excel; // Creating the workbook with one worksheet. IWorkbook workbook = application.Workbooks.Create(1); // The first worksheet object in the worksheets collection is accessed. IWorksheet sheet = workbook.Worksheets[0]; // Workbook version is set workbook.Version = ExcelVersion.Excel2010; string filename = "Sample.xlsx"; // `ExcelHttpContentType` is set as the file version. workbook.SaveAs(filename, HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2010); VB 'Step 1 : Instantiate the spreadsheet creation engine. Dim excelEngine As ExcelEngine = New ExcelEngine() 'Step 2 : Instantiate the Excel application object. Dim application As IApplication = excelEngine.Excel 'Creating the workbook with Dim workbook As IWorkbook = application.Workbooks.Create(1) 'The first worksheet object in the worksheets collection is accessed. Dim sheet As IWorksheet = workbook.Worksheets(0) 'Workbook version is set workbook.Version = ExcelVersion.Excel2010 Dim filename As String = "Sample.xlsx" `ExcelHttpContentType` is set as the file version. workbook.SaveAs(filename, HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2010) The sample illustrating this can be downloaded here. Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples.  Conclusion I hope you enjoyed learning about how to avoid file corruption while opening the generated file using XlsIO in .NET MVC web application.You can refer to our .NET MVC XlsIO  feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our .NET MVC XlsIO example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to avoid file corruption when opening generated file in .NET Web Forms XlsIO?
XlsIO-generated files will be downloaded in .xls format in some browsers by default, even when we add the extension in the file name or set the version for the file. Because of this the downloaded file gets corrupted. To overcome this, set ExcelHttpContentType while saving the file in XlsIO.   Below code snippet demonstrates on how to set ExcelHttpContentType while saving .xlsx format file using XlsIO. C# // Step 1: Instantiate the spreadsheet creation engine. ExcelEngine excelEngine = new ExcelEngine(); // Step 2: Instantiate the Excel application object. IApplication application = excelEngine.Excel; // Creating the workbook with one worksheet. IWorkbook workbook = application.Workbooks.Create(1); // The first worksheet object in the worksheets collection is accessed. IWorksheet sheet = workbook.Worksheets[0]; // Workbook version is set workbook.Version = ExcelVersion.Excel2010; string filename = "Sample.xlsx"; // ExcelHttpContentType is set as the file version. workbook.SaveAs(filename, HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2010); VB 'Step 1 : Instantiate the spreadsheet creation engine. Dim excelEngine As ExcelEngine = New ExcelEngine() 'Step 2 : Instantiate the excel application object. Dim application As IApplication = excelEngine.Excel 'Creating the workbook with one worksheet. Dim workbook As IWorkbook = application.Workbooks.Create(1) 'The first worksheet object in the worksheets collection is accessed. Dim sheet As IWorksheet = workbook.Worksheets(0) 'Workbook version is set workbook.Version = ExcelVersion.Excel2010 Dim filename As String = "Sample.xlsx" 'ExcelHttpContentType is set as the file version. workbook.SaveAs(filename, HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2010) The sample illustrating this can be downloaded here. Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples. ConclusionI hope you enjoyed learning about how to avoid file corruption while opening the generated file using XlsIO in .NET WebForms.You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion® components.If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums, Support Tickets, or feedback portal. We are always happy to assist you!
In web application, how to avoid file corruption while opening the generated file using XlsIO?
XlsIO generated file will be downloaded as .xls format in some browsers by default, even when we add the extension in the file name or set the version for the file. Because of this the downloaded file gets corrupted. To overcome this, set ExcelHttpContentType while saving the file in XlsIO.   Below code snippet demonstrates on how to set ExcelHttpContentType while saving .xlsx format file using XlsIO. C# VB The sample illustrating this can be downloaded here.
How to avoid file corruption while opening the generated file using XlsIO in .NET MVC ?
XlsIO generated files will be downloaded in .xls format in some browsers by default, even when we add the extension in the file name or set the version for the file. Because of this, the downloaded file gets corrupted. To overcome this, set ExcelHttpContentType while saving the file in XlsIO.   Below code snippet demonstrates how to set ExcelHttpContentType while saving .xlsx format file using a XlsIO. C# // Step 1 : Instantiate the spreadsheet creation engine. ExcelEngine excelEngine = new ExcelEngine(); // Step 2 : Instantiate the Excel application object. IApplication application = excelEngine.Excel; // Creating the workbook with IWorkbook workbook = application.Workbooks.Create(1); // The first worksheet object in the worksheets collection is accessed. IWorksheet sheet = workbook.Worksheets[0]; / /Workbook version is set workbook.Version = ExcelVersion.Excel2010; string filename = "Sample.xlsx"; // ExcelHttpContentType is set as file version workbook.SaveAs(filename, HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2010); VB 'Step 1 : Instantiate the spreadsheet creation engine. Dim excelEngine As ExcelEngine = New ExcelEngine() 'Step 2 : Instantiate the excel application object. Dim application As IApplication = excelEngine.Excel 'Creating the workbook with Dim workbook As IWorkbook = application.Workbooks.Create(1) 'The first worksheet object in the worksheets collection is accessed. Dim sheet As IWorksheet = workbook.Worksheets(0) 'Workbook version is set workbook.Version = ExcelVersion.Excel2010 Dim filename As String = "Sample.xlsx" 'ExcelHttpContentType is set as file version workbook.SaveAs(filename, HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2010) Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples. ConclusionI hope you enjoyed learning about how to avoid file corruption while opening the generated file using XlsIO in .NET MVC.You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion® components.If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums, Support Tickets, or feedback portal. We are always happy to assist you!
No articles found
No articles found
1 of 1 pages (4 items)