导出.xlsm文件时遇到无法读取的内容错误

时间:2017-04-11 01:00:53

标签: c#

电子表格在尝试导出.xlsm文件时显示警告消息。

导出按钮代码:

    var binData = new byte[filename.PostedFile.ContentLength];

    filename.PostedFile.InputStream.Read(binData, 0, filename.PostedFile.ContentLength);

    filename.PostedFile.InputStream.Close();

    Stream st = new MemoryStream(binData); 

    Download excel = new Download();

    byte[] result = excel.Generate(list, st, code); 

    Response.AddHeader("content-disposition", string.Format("attachment;  filename={0}", filename.FileName));

    Response.ContentType = "application/vnd.ms-excel.sheet.macroEnabled.12";

    Response.BinaryWrite(result);

0 个答案:

没有答案