找回密码
 立即注册

QQ登录

只需一步,快速开始

E时间

注册会员

17

主题

48

帖子

137

积分

注册会员

积分
137

微信认证勋章

E时间
注册会员   /  发表于:2016-9-21 09:38  /   查看:3355  /  回复:3
   exporter.SaveExcel(stream, fileFormat, excelSaveFlags, password); 保存EXCEL文件的地址在那里?
W20160921093709.png

3 个回复

倒序浏览
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-9-21 12:01:26
推荐
换种方式,这个我测试了,没问题。

  1.             using (var fileStream1 = System.IO.File.Create(Server.MapPath("../aa1.xlsx")))
  2.             {
  3.                 stream.Seek(0, SeekOrigin.Begin);
  4.                 stream.CopyTo(fileStream1);
  5.             }
复制代码
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-9-21 10:05:26
沙发
您好,您用的是 SaveExcel(stream ,这个重载方法是保存到内存中,如果您需要保存到服务器,将这个stream 再保存成文件就好了。

参考代码
  1. FileStream fileStream = File.Create(fileFullPath, (int)stream.Length);
  2. // Initialize the bytes array with the stream length and then fill it with data
  3. byte[] bytesInStream = new byte[stream.Length];
  4. stream.Read(bytesInStream, 0, bytesInStream.Length);   
  5. // Use write method to write to the file specified above
  6. fileStream.Write(bytesInStream, 0, bytesInStream.Length);
复制代码
回复 使用道具 举报
E时间
注册会员   /  发表于:2016-9-21 10:55:43
板凳
是的通过stream ,这样写有错的,那数据流如何生成EXCEL文件?
AQ20160921105302.png
AQ20160921105348.png
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部