使用EPPlus创建的excel文件,在打开该文件时必须显示消息,单击是

时间:2015-11-27 09:23:38

标签: excel epplus

点击“是”后,显示:

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

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

我认为代码没有问题,但我的代码仍然是我用来创建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();
}

1 个答案:

答案 0 :(得分:6)

当我在使用EPPlus时遇到此问题是因为我试图超出Excel的限制。

在我的情况下,我试图在一个单元格中插入超过32,767个字符。

此处给出了Excel的限制: https://support.office.com/en-MY/article/Excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa

相关问题