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. Image for the cookie policy date

Excel Workbook displays content error message when opening

Using ASP.net core and Angular
Created a Excel workbook using Syncfusion.XlsIO.ExcelEngine
Downloaded the workbook as a Stream (file).
When I open it I get the message in the attached file(*.png)
Message: "We found a problem with some content in ''. Do you want us to try to recover as much as we ccan?..."
When Yes is clicked another dialog box appears.
The data in the opened spreadsheet is as expected ie what the DataTable held.

Here is a copy of the code used to create the workbook:
           DataTable dt = ConvertListToDatatable(headers, details);
            MemoryStream stream = new MemoryStream();
            stream.Position = 0;
            using (Syncfusion.XlsIO.ExcelEngine excelEngine = new Syncfusion.XlsIO.ExcelEngine())
                Syncfusion.XlsIO.IWorkbook workbook = excelEngine.Excel.Workbooks.Create(1);
                workbook.Version = Syncfusion.XlsIO.ExcelVersion.Excel2016;

                    Syncfusion.XlsIO.IWorksheet sheet = workbook.Worksheets[0];
                    sheet.ImportDataTable(dt, true, 1, 1);
                    sheet.Name = "Fred Schedule";

Attachment: ExcelContentError_ffd0d971.zip

3 Replies

AV Abirami Varadharajan Syncfusion Team July 3, 2019 11:19 AM UTC

Hi Greg, 

Greetings from Syncfusion. 

We are unable to reproduce the issue with the shared information. We request you to share the issue reproducing sample along with the corrupted document which will be helpful for us to find the exact root cause of the issue and to provide prompt solution at the earliest. 


GF Greg Frazer July 3, 2019 10:12 PM UTC

Solution has been found.
It was the way the document was been downloaded
It was not working with
return File(
                    filecontent    = stream.GetBuffer(),
                    ContentType = ""application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                    fileName      = "Fredschedule.xlsx"
It works with
return new FileStreamResult(stream, "application/octet-stream")
                FileDownloadName = "Fredschedule.xlsx"
this issue can be closed

AV Abirami Varadharajan Syncfusion Team July 4, 2019 11:54 AM UTC

Hi Greg, 

Thank you for updating us. 

We are glad that the issue is resolved at your end. Please let us know if you need further assistance. 


Live Chat Icon For mobile
Up arrow icon