Tôi đang tạo tệp Excel bằng thư viện EPPlus. Khi tôi tạo tệp và mở tệp, thông báo bật lên sau hiển thị:Hộp thoại báo lỗi hiển thị khi mở tệp excel được tạo bằng EPPlus
Chúng tôi đã phát hiện sự cố với một số nội dung trong 'ExcelDemo.xlsx'. Bạn có muốn chúng tôi cố gắng phục hồi càng nhiều càng tốt? Nếu bạn tin tưởng là nguồn gốc của cuốn sách này, Nhấn Yes
Tôi đang sử dụng đoạn mã sau
using (ExcelPackage pck = new ExcelPackage())
{
//Create the worksheet
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Demo");
//Load the datatable into the sheet, starting from cell A1. Print the column names on row 1
ws.Cells[1, 2].Value = "Excel Download";
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment; filename=ExcelDemo.xlsx");
Response.BinaryWrite(pck.GetAsByteArray());
}
Có vấn đề trong mã của tôi hay đây là một vấn đề Excel?
Tôi đã tìm thấy [diễn đàn này] (https://social.technet.microsoft.com/Forums/office/en-US/f217048b-aa7c-4b6e-a346-59e0445543f6/we-found-a-problem-with- một số nội dung-trong-filenamexlsxdo-bạn-muốn-chúng tôi-to-try-to-phục hồi-as-nhiều-như? diễn đàn = excel) cho thấy bạn chỉ có thể sử dụng tài sản 'Cell.Value' cho các số gây ra vấn đề bạn thấy. – chancea