We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

XlsIO MVC - File Generation Issue - Unreadable content

Thread ID:





97990 Jan 24,2011 10:29 AM UTC Jan 25,2011 12:43 PM UTC ASP.NET Web Forms (Classic) 2
Tags: XlsIO
Andrea Batazzi
Asked On January 24, 2011 10:29 AM UTC

I am generating an excel file in a MVC controller.
Everything works wonderfully when on my dev machine (Win 7 64bit). Once I move the app to our development server ( windows 2008 - IIS 7.5), the file gets generated, but once it is downloaded, I get the following warning : "Excel found unreadable content in 'xxx'. Do you want to recover...." .
I did a binary comparison of the generated files ( my dev machine vs dev server ) and noticed that the file is different, although the actual Excel content is the same.

Strangely enough genrating in Excel 97/2003 format does not lead up to this error.

Any clues ?
Thank you.

Andrea Batazzi
Replied On January 24, 2011 10:36 AM UTC

Snippet ( I am using the extensions provided in the product samples ExcelResult.cs and XlsIOExtension.cs) :

ExcelEngine excelEngine = new ExcelEngine();
IWorkbook workbook = null;
if (Excel == "97")
workbook = excelEngine.Excel.Workbooks.Open(ResolveApplicationDataPath(string.Format("Standard_B_{0}.xls", IDBrand)), ExcelOpenType.Automatic, ExcelVersion.Excel97to2003);
else if (Excel == "2007")
workbook = excelEngine.Excel.Workbooks.Open(ResolveApplicationDataPath(string.Format("Standard_B_{0}.xlsx", IDBrand)), ExcelOpenType.Automatic, ExcelVersion.Excel2007);

IWorksheet sheet = workbook.Worksheets[0];
ITemplateMarkersProcessor marker = sheet.CreateTemplateMarkersProcessor();
marker.AddVariable("Report", dt);
sheet.Visibility = WorksheetVisibility.StrongHidden;
//Saving the workbook to disk. This spreadsheet is the result of opening and modifying
//an existing spreadsheet and then saving the result to a new workbook.

if (Excel == "97")

return excelEngine.SaveAsActionResult(workbook, IDBrand == 1 ? "CRMStandardB.xls" : "ReportNominativi.xls", HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2000);
else if (Excel == "2007")
workbook.Version = ExcelVersion.Excel2007;
//EVEN IF SAVE TO FS AND OPENED VIA FS I GET THE SAME ISSUE workbook.SaveAs(ResolveApplicationDataPath(string.Format("0000.xls")),ExcelSaveType.SaveAsXLS);
return excelEngine.SaveAsActionResult(workbook, IDBrand == 1 ? "CRMStandardB.xlsx" : "ReportNominativi.xlsx", HttpContext.ApplicationInstance.Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2007);

John Bowlin Bosco K [Syncfusion]
Replied On January 25, 2011 12:43 PM UTC

Hi Andrea,

Thank you very much for using Syncfusion Products.

Currently we are setting up an environment to reproduce the issue at our side. So we will get back to you with more details in two business days (i.e., 27th Jan 2011). We deeply regret for the inconvenience caused.

Please let us know if you have any concerns.

Pauline Bosco.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon