【问题标题】:Excel opens file created by EPPlus with errorExcel 打开 EPPlus 创建的文件时出现错误
【发布时间】:2016-08-18 07:45:37
【问题描述】:

我通过 EPPlus 创建了带有 2 张工作表的 excel 文件:数据和数据图表。 Excel 可以毫无错误地打开文件。

现在,我读取(通过 EPPlus)并再次保存文件,没有任何更改,Excel 打开文件并显示错误消息并且不显示图表。

xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error118920_01.xml</logFileName><summary>Errors were detected in file 'file.xlsx'</summary><removedParts summary="Following is a list of removed parts:"><removedPart>Removed Part: /xl/drawings/drawing1.xml part. (Drawing shape)</removedPart></removedParts></recoveryLog>

【问题讨论】:

标签: excel epplus


【解决方案1】:

抱歉这么晚才回复。似乎该 Excel 文件在图表 x 轴中的引用不正确。如果您转到图表的选择数据并点击右侧的编辑类别轴标签,您将看到:

但是 ='Charts'! 看起来像是一个损坏的参考。似乎 Epplus 不能很好地处理这个问题 - 可能应该将其记录为错误。因此,要修复它取消它,请单击图表 x 轴并点击删除。之后应该是这样的:

保存文件并通过您的单元测试运行它,它会为我正确打开。

厄尼

【讨论】:

  • 我通过下一个代码字符串定义了系列 yName = String.Format("'" + dataWorkSheet.Name + "'" + "!{0}2:{0}{1}", columnName,行数); var excelChartSerie = chart.Series.Add(yName, "");
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-10-08
  • 2015-11-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多