找回密码
 立即注册

QQ登录

只需一步,快速开始

dexteryao 讲师达人认证 悬赏达人认证 SpreadJS 开发认证

超级版主

124

主题

8928

帖子

1万

积分

超级版主

Rank: 8Rank: 8

积分
13548

讲师达人悬赏达人元老葡萄SpreadJS 认证SpreadJS 高级认证微信认证勋章

dexteryao 讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-3-8 12:08  /   查看:6371  /  回复:0

是用MVC上传下载Excel,并使用SpreadJS显示
  1.         // GET: Home
  2.         public ActionResult Index()
  3.         {
  4.             if (Request.Files != null && Request.Files.Count > 0)
  5.             {
  6.                 var file = Request.Files[0];

  7.                 Importer excelImport = new Importer();
  8.                 var text = excelImport.ImportExcel(file.InputStream);
  9.                 ViewBag.ExcelJson = text;
  10.             }

  11.             return View();
  12.         }
  13.    
  14.         [HttpPost]
  15.         public ActionResult ExportFile(string jsonString)
  16.         {
  17.             Exporter excelExporter = new Exporter(jsonString);


  18.             excelExporter.SaveExcel(Response.OutputStream);
  19.             Response.AddHeader("content-disposition", "attachment; filename= test.xlsx");
  20.             Response.End();
  21.             return View();
  22.         }
复制代码





02SpreadJSExcelIO.zip (9.17 MB, 下载次数: 1122)

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部