我使用 C# 中的 Open XML SDK 创建了一个电子表格,并成功填充了两个工作表。
当尝试填充第三个时,我得到了“内容不可读”打开已完成的文档时出错,并且当我尝试在第三个文档中连续填充超过 25 个单元格时,似乎会发生此错误。
我使用的代码片段与文档中其他地方成功运行的代码片段相同:
string[] headers2 = {
"Reference", "Raised", "Priority", "Affected", "Linked incidents",
"Points", "SLA", "Stopped", "Target" };
// remaining headers are month/years created on the fly
string[] headerCells = {
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH" };
...
// headers
// once we've finished the presets, the month/year pairs take over
cellNo = (uint)0;
foreach (string h in headers2)
{
cell = InsertCellInWorksheet(headerCells[cellNo++], 2, worksheetPart);
cell.CellValue = new CellValue(h);
cell.DataType = new EnumValue<CellValues>(CellValues.String);
}
string[] monthYears =
GetData_month_years(currentReportingPeriod - 1);
for (int j = 0; j < monthYears.Count(); j++)
{
cell = InsertCellInWorksheet(headerCells[cellNo++], 2, worksheetPart);
cell.CellValue = new CellValue(monthYears[j].ToString());
cell.DataType = new EnumValue<CellValues>(CellValues.String);
}
唯一填充的单元格是 A 和 AA 到 AH。
我认为我达到了某种限制是正确的吗?如果是这样,重置它的方法是什么?
我看过几篇关于不可读内容错误的帖子,并且浏览了文档,但到目前为止我找不到任何适用的内容。
帮助将不胜感激!
Thanks