1 Star 0 Fork 30

li_yi / ejsExcel

forked from Sail / ejsExcel 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ejsExcel

nodejs excel template engine. node export excel, ejsExcel

How to use?

npm install ejsexcel

How to test?

  • 执行 test/test.bat

    test/test.bat
  • test/test.xlsx 为完整示例 demo

  • e.g

     const ejsexcel = require("ejsexcel");
     const fs = require("fs");
     const util = require("util");
     const readFileAsync = util.promisify(fs.readFile);
     const writeFileAsync = util.promisify(fs.writeFile);
     
    (async function() {
      //获得Excel模板的buffer对象
      const exlBuf = await readFileAsync("./test.xlsx");
      //数据源
      const data = [];
      //用数据源(对象)data渲染Excel模板
      const exlBuf2 = await ejsexcel.renderExcel(exlBuf, data);
      await writeFileAsync("./test2.xlsx", exlBuf2);
      console.log("生成test2.xlsx");
    })();

Syntax

Syntax Description
data data 为内置对象, 数据源
<%forRow 循环一行
<%# 输出动态公式
<%~ 输出数字类型格式
<%= 输出字符串
<%forCell 循环单元格
<%forRBegin 循环多行
<%forCBegin 循环多个单元格
<%hideSheet()%> 隐藏所在工作表
<%showSheet()%> 显示所在工作表
<%deleteSheet()%> 删除所在工作表
<% %> 内部可执行 任意 javascript,可以用 <%console.log(data)%> 打印临时变量到控制台,进行调试

Author

Templates

做一个这样的模版 模板

Result

加数据渲染之后,导出结果

导出结果

捐赠鼓励支持此项目,支付宝扫描:

捐赠鼓励支持此项目

项目贡献人列表

  • @Hello World ¥50
  • @德爾文 ¥50
  • @Explore® ¥50
  • @向左转 ¥50
  • @吴燕飞 ¥50
  • @strive-ming ¥10
  • @MR.P ¥16.66
  • @不求来生 ¥6.60
  • @羊刀 ¥6.66
  • @Leo ¥8.88
Copyright 2013 Sail 黄智勇 (151263555@qq.com) This project is free software released under the MIT/X11 license: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

nodejs excel template engine. node export excel 展开 收起
NodeJS
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
NodeJS
1
https://gitee.com/liliang_linux/ejsExcel.git
git@gitee.com:liliang_linux/ejsExcel.git
liliang_linux
ejsExcel
ejsExcel
master

搜索帮助