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

Excel found unreadable content

Thread ID:





88551 Jul 29,2009 03:44 PM UTC Nov 29,2013 05:52 AM UTC WinForms 6
Tags: XlsIO
Shawn Benson
Asked On July 29, 2009 03:44 PM UTC

When I create a table, whether I hard code the range or use sheet.UsedRange, I get an exception when Excel 2007 tries to open the file:

“Excel found unreadable content in [filename]. Do you want to recover this workbook? If you trust the source of this workbook, click Yes.”

Code snippet is below.

ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2007;

IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];

SqlConnection sqlConn = new SqlConnection(PricingServiceAudit.Properties.Settings.Default.StagingConnectionString);
SqlCommand cmd_sp_Pricing_Audit = new SqlCommand("sp_Pricing_Audit", sqlConn);
DataTable oPricing_Audit = new DataTable();

if (maskedEditBoxJobID.Text.ToString() == "")
MessageBox.Show("Please Enter a Job ID.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
else { saveFileDialog1.FileName = "Pricing Service Review " + maskedEditBoxJobID.Text.ToString() + ".xlsx"; }

if (saveFileDialog1.ShowDialog() != DialogResult.Cancel)
string fileName = saveFileDialog1.FileName.ToString();

cmd_sp_Pricing_Audit.CommandType = CommandType.StoredProcedure;
cmd_sp_Pricing_Audit.Parameters.Add("@job_id", SqlDbType.Int);
cmd_sp_Pricing_Audit.Parameters["@job_id"].Value = Convert.ToInt32(maskedEditBoxJobID.Text.ToString());

SqlDataAdapter oDA = new SqlDataAdapter(cmd_sp_Pricing_Audit);

Cursor.Current = Cursors.WaitCursor;


sheet.ImportDataTable(oPricing_Audit, true, 1, 1 , -1, -1,true);

// Create table
IListObject Table1 = sheet.ListObjects.Create("Table1", sheet.UsedRange);

// Apply builtin style
Table1.BuiltInTableStyle = TableBuiltInStyles.TableStyleMedium2;


//Saving the workbook to disk.

Cursor.Current = Cursors.Default;

catch (Exception exp)
MessageBox.Show(exp.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (sqlConn.State == ConnectionState.Open) { sqlConn.Close(); }

Geetha M [Syncfusion]
Replied On July 30, 2009 07:32 AM UTC

Hi Shawn,

Thank you for your interest in Syncfusion products.

I was able to reproduce the problem. This is suspected to be a defect and we have forwarded it to our development team. Could you please create a direct trac incident to follow up with the same?

Meanwhile you can try using the workaround given below.

IRange range = sheet.UsedRange;

// Create table
IListObject Table1 = sheet.ListObjects.Create("Table1", sheet[range.Row, range.Column, range.LastRow + 1, range.LastColumn]);

// Apply builtin style
Table1.BuiltInTableStyle = TableBuiltInStyles.TableStyleMedium2;


//Hide the Total Row
sheet.ShowRow(range.LastRow + 1, false);

Please try this and let me know if you have any questions.


Shawn Benson
Replied On July 31, 2009 02:51 PM UTC

Incident #58627.


Shawn Benson
Replied On July 31, 2009 02:58 PM UTC

Forgot to mention the work around works except that the columns are not auto sized correctly. It is like it they are sized before the auto filter is enabled.

Geetha M [Syncfusion]
Replied On August 3, 2009 05:39 AM UTC

Hi Shawn,

Thank you for the update.

I was able to see the problem. Please follow up with incident #58627 for more details.

Please let me know if you have any other questions.


Replied On November 25, 2013 10:41 AM UTC


I have the same problem but i don't think it is comming from the columns.
My code :

IWorkbook classeurSource = ExcelUtils.CreateWorkBookUsingTemplate(cheminModeleExport);


Manoj Kumar G M [Syncfusion]
Replied On November 29, 2013 05:52 AM UTC

Hi Chicodelloft,

Thank you for using Syncfusion products.

We are unable to reproduce the reported issue at our end. We request you to send us the excel template that causes the issue to investigate further on this and get back to you with a prompt solution. Kindly create a new incident from the below direct track link and update us the template in the incident. We can look into the issue and update you with further details.

Direct Track Link: http://www.syncfusion.com/support/directtrac/dtnewpost

Please let us know if you need any clarification.



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