Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

excel file created with EPPlus, displaying message while opening that file has to repair, click yes

Tags:

excel

epplus

After click yes, it is showing:

Repaired Records: String properties from /xl/sharedStrings.xml part(Strings)

Repaired Records: Table from /xl/tables/table.xml part(Table)

I think there is no problem in code, but still here is my code what I am using to create Excel.

using (var package = new ExcelPackage(newFile)) {
     ExcelWorksheet worksheet = null;
     worksheet = package.Workbook.Worksheets.Add(dataToExcelExport.TableName);
     worksheet.Cells["A1"].LoadFromDataTable(dataToExcelExport, true, 
                                             OfficeOpenXml.Table.TableStyles.None);
     worksheet.Row(1).Style.Font.Bold = true;
     worksheet.Column(4).Width = 55.00;
     worksheet.Column(4).Style.WrapText = true;
     worksheet.Cells[1, 1, worksheet.Dimension.End.Row, 3].AutoFitColumns();
     package.Save();
     worksheet.Dispose();
}
like image 251
ravi Avatar asked Nov 27 '15 09:11

ravi


1 Answers

When I encountered this issue while using EPPlus it was because I was trying to exceed limits imposed by Excel.

In my case I was trying to insert more than 32,767 characters in a cell.

Limits for Excel are given here: https://support.office.com/en-MY/article/Excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa

like image 192
Gavin Avatar answered Sep 22 '22 13:09

Gavin