Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
450
Error : Excel found unreadable content in 'filename.xlsx'.....
posted

Hi,

When I try to open excel file generated using Infragistics.Excel - I am getting below exception....

"Excel found unreadable content in 'filename.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, Click Yes"

After Repaired it shows in repair log - "Repaired Records: Worksheet properties from /xl/worksheets/sheet1.xml part"

After my analysis on the issue i found below line of code causing the issue.

workSheet.PrintOptions.InsertPageBreak(workSheet.Rows[headerRow]);

 

Part of my code FYR...

 

workSheet.PrintOptions.InsertPageBreak(workSheet.Rows[headerRow]);

workSheet.PrintOptions.InsertPageBreak(workSheet.Columns[reportSet.Tables[0].Columns.Count]);

workSheet.PrintOptions.Orientation = Infragistics.Documents.Excel.

Orientation.Landscape;

workSheet.PrintOptions.PaperSize =

PaperSize.Legal;

workSheet.PrintOptions.LeftMargin = 0.2;

workSheet.PrintOptions.RightMargin = 0.2;

workSheet.PrintOptions.ScalingFactor = 72;