zoukankan      html  css  js  c++  java
  • NPOI Mapper导出Excel

    .NET FrameWork

    返回对象

    HttpResponseMessage

    测试

    List<ImportExcel_Model> students = new List<ImportExcel_Model>
    {
    new ImportExcel_Model{ name="夫子",email="15153989759@qq.com",mobile_phone="15053989759" },
    new ImportExcel_Model{ name="余帘",email="15153989759@qq.com",mobile_phone="151539459759" },
    new ImportExcel_Model{ name="李慢慢",email="15153989759@qq.com",mobile_phone="15153989459" },
    };

    var mapper = new Mapper();
    MemoryStream stream = new MemoryStream();
    mapper.Save(stream, students, "sheet1", overwrite: true, xlsx: true);
    return new HttpResponseMessage { Content = new ByteArrayContent(stream.ToArray()) };

    Core

    返回对象

    ActionResult

    实现

    List<ImportExcel_Model> students = new List<ImportExcel_Model>
    {
    new ImportExcel_Model{ name="夫子",email="15153989759@qq.com",mobile_phone="15150989759" },
    new ImportExcel_Model{ name="余帘",email="15153989759@qq.com",mobile_phone="15152989759" },
    new ImportExcel_Model{ name="李慢慢",email="15153989759@qq.com",mobile_phone="15153989739" },
    };

    var mapper = new Mapper();
    MemoryStream stream = new MemoryStream();
    mapper.Save(stream, students, "sheet1", overwrite: true, xlsx: true);
    return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Demo.xlsx");

  • 相关阅读:
    原生小程序音频播放
    Vue定义全局过滤器filter
    系统扩展性之引入外部包
    oracle update join
    OAuth2
    oracle pl/sql
    MySQL同步工具otter的使用介绍(一)
    python批量安装apk
    mac brew安装redis
    antd 修改Modal的底部按钮颜色
  • 原文地址:https://www.cnblogs.com/cdjbolg/p/15464696.html
Copyright © 2011-2022 走看看