Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Epplus的小计函数时,我得到;Excel在…“中发现不可读的内容”;错误_C#_Asp.net_Epplus - Fatal编程技术网

C# 使用Epplus的小计函数时,我得到;Excel在…“中发现不可读的内容”;错误

C# 使用Epplus的小计函数时,我得到;Excel在…“中发现不可读的内容”;错误,c#,asp.net,epplus,C#,Asp.net,Epplus,我有一个简单的Excel文件生成的Epplus图书馆在我的网页;但是,当我使用excel函数“subtotal”时,出现以下错误: Excel在中发现无法读取的内容 代码如下: protected void Page_Load(object sender, EventArgs e) { ExcelPackage pck = new ExcelPackage(); ExcelWorksheet ws = pck.Workbook.Worksheets.Add("hoja1");

我有一个简单的Excel文件生成的Epplus图书馆在我的网页;但是,当我使用excel函数“subtotal”时,出现以下错误:

Excel在中发现无法读取的内容

代码如下:

protected void Page_Load(object sender, EventArgs e)
{
   ExcelPackage pck = new ExcelPackage();
   ExcelWorksheet ws = pck.Workbook.Worksheets.Add("hoja1");

   ws.Cells["A1"].Value = 1;
   ws.Cells["A2"].Value = 2;
   ws.Cells["A3"].Value = 3;
   ws.Cells["A1:A3"].Style.Numberformat.Format = "#,##0";

   ws.Cells["A4"].Formula= "SUBTOTAL(9;A1:A3)";

   Response.Clear();
   Response.AddHeader("content-disposition", 
        string.Format("attachment;filename=\"{0}\"", "Reporte.xlsx"));
   Response.ContentType = 
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
   Response.BinaryWrite(pck.GetAsByteArray());
   Response.End();
}
和包含详细信息的xml文档:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
   <logFileName>error057400_01.xml</logFileName>
   <summary>
      Se han detectado errores en el archivo "C:\xxxxxx\Content.IE5\MAW7NL0X\Reporte.xlsx"
   </summary>
   <removedRecords summary="Lista de registros eliminados:">
      <removedRecord>
          Registros quitados: Fórmula de /xl/worksheets/sheet1.xml parte
      </removedRecord>
</removedRecords></recoveryLog>

不确定这是否是问题所在,但请尝试将“;”替换为“,”:


祝你好运。

我欠你一条命。
ws.Cells["A4"].Formula= "SUM(A1:A3)";
ws.Cells["A4"].Formula= "SUBTOTAL(9,A1:A3)";