Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Repaired Records: Worksheet properties from /xl/workbook.xml part [14872]

$
0
0
When I create spreadsheet with many worksheets via my site using EPPlus, I get the following error:

Excel found unreadable content in ViewData2023_all.xlsx Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

Then I get the Repairs popup, and when I open up the log file I see:

<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error094560_01.xml</logFileName><summary>Errors were detected in file 'C:\Users\xxx\Downloads\ViewData2023_all.xlsx'</summary>-<repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Worksheet properties from /xl/workbook.xml part (Workbook)</repairedRecord></repairedRecords></recoveryLog>

Here is a sample of the code:
using (ExcelPackage package = new ExcelPackage())
{
foreach (Install install in Installs)
{
DataWorksheet dwtest = BuildDataWorksheet(site1ID_int, install.InstallID.ToString(), StartDate, EndDate);
if (dwtest.DataRecords.Count > 0)
{

string worksheetName = dwtest.Name;

ExcelWorksheet ws = package.Workbook.Worksheets.Add(worksheetName);

int chssz = dwtest.ColumnHeaders.Count;

int worksheet_col = 0;
int worksheet_row = 0;
for (int hdr_col = 1; hdr_col <= dwtest.ColumnHeaders.Count; hdr_col++)
{
worksheet_col = hdr_col - 1;
ws.Cells[1, hdr_col].Value = dwtest.ColumnHeaders[worksheet_col];
}

for (int cell_row = 2; cell_row <= (dwtest.DataRecords.Count + 1); cell_row++)
{
worksheet_row = cell_row - 2;
for (int cell_column = 1; cell_column <= dwtest.DataRecords[worksheet_row].CellValues.Count; cell_column++)
{
worksheet_col = cell_column - 1;
ws.Cells[cell_row, cell_column].Value = dwtest.DataRecords[worksheet_row].CellValues[worksheet_col];
}
}
} // end of if DataWorksheet has DataRecords
} // end of foreach

var stream = new MemoryStream();
package.SaveAs(stream);

string fileName = "ViewData.xlsx";
string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

stream.Position = 0;
return File(stream, contentType, fileName);
}
}

Note:
- when I open in Excel and resave the spreadsheet is fine
- when I create a spreadsheet with one worksheet, the spreadsheet is fine

Thanks!
Comments: I am seeing this exact same error. Any thoughts on when a fix might be available for this issue?

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>