Giter VIP home page Giter VIP logo

jsonexportexcel's Introduction

JsonExportExcel

json导出excel 支持中文

EXAMPLE

es6请查看js-export-excel版本

记得点star

by kin

安装方法

# clone项目
 git clone  https://github.com/cuikangjie/JsonExportExcel.git

使用方法

1.引入js (dist目录下JsonExportExcel.min.js)

<script src="dist/JsonExportExcel.min.js"></script>

2.js代码

var option={};

option.fileName = 'excel'
option.datas=[
  {
    sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}],
    sheetName:'sheet',
    sheetFilter:['two','one'],
    sheetHeader:['第一列','第二列']
  },
  {
    sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}]
  }
];
var toExcel=new ExportJsonExcel(option);
toExcel.saveExcel();

option

  • datas 数据

    /*多个sheet*/
    /*每个sheet为一个object */
    [{
    sheetData:[], // 数据
    sheetName:'', // sheet名字
    sheetFilter:[], //列过滤
    sheetHeader:[] // 第一行
    }]
    
  • fileName 下载文件名(默认:download)

sheet option

  • sheetName sheet名字(可有可无)(默认sheet1)

  • sheetHeader 标题(excel第一行数据)

    sheetHeader:['第一列','第二列']
  • sheetData 数据源(必须)

    <!--两种形式-->
    <!--第一种 object-->
    [{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}]
    <!--第二种 arrary-->
    [['一行一列','一行二列'],['二行一列','二行二列']]
  • sheetFilter 列过滤(只有在data为object下起作用)(可有可无)

    sheetFilter=['two','one'];

效果预览

Paste_Image.png

浏览器支持

ie 10+

赞助

Paste_Image.png

请我喝杯咖啡 ¥28

log

  • 2017.4.27

    增加标题配置

    增加多个sheet功能

    优化代码

    支持safiri浏览器

jsonexportexcel's People

Contributors

kinddde avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.