Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sail-sail/deno_ejsexcel

deno for ejsExcel
https://github.com/sail-sail/deno_ejsexcel

Last synced: 21 days ago
JSON representation

deno for ejsExcel

Awesome Lists containing this project

README

        

deno_ejsexcel
--------
> deno excel template engine. deno export excel, ejsexcel
> This is a port of https://github.com/sail-sail/ejsExcel

### How to use?
```ts
import { renderExcel } from "../mod.ts";

//获得Excel模板的buffer对象
const exlBuf = await Deno.readFile("./test/test.xlsx");
//数据源
const data = [[{"dpt_des":"开发部","doc_dt":"2013-09-09","doc":"a001"}],[{"pt":"pt1","des":"des1","due_dt":"2013-08-07","des2":"2013-12-07"},{"pt":"pt1","des":"des1","due_dt":"2013-09-14","des2":"des21"}]];
//用数据源(对象)data渲染Excel模板
const exlBuf2 = await renderExcel(exlBuf, data);
await Deno.writeFile("./test/test2.xlsx", exlBuf2);
console.log("生成test2.xlsx");
```

### How to test?
```bash
deno run --allow-env=NODE_DEBUG --allow-read --allow-write ./test/testExcel.ts
deno run --allow-env=NODE_DEBUG --allow-read --allow-write ./test/testExcel2.ts
```
- test/test.xlsx 为完整示例 demo

## Syntax

| Syntax | Description |
|-----------------------|-------------------------------------------|
| _data_ | _data_ 为内置对象, 数据源 |
| <%forRow | 循环一行 |
| <%# | 输出动态公式 |
| <%~ | 输出数字类型格式 |
| <%= | 输出字符串 |
| <%forCell | 循环单元格 |
| <%forRBegin | 循环多行 |
| <%forCBegin | 循环多个单元格 |
| `<%_mergeCellFn_("C2:E2")%>` | 合并单元格`C2:E2` |
| `<%_dataValidation_({ sqref: "A1:A3", formula1: "\"序列1,序列2\"" })%>` | 数据验证 |
| <%_hideSheet_()%> | 隐藏所在工作表 |
| <%_showSheet_()%> | 显示所在工作表 |
| <%_deleteSheet_()%> | 删除所在工作表 |
| <% %> | 内部可执行 任意 javascript,可以用 <%console.log(_data_)%> 打印临时变量到控制台,进行调试 |

## Author
+ Author: Sail
- QQ: 151263555
- QQ群: 470988427
- email: [email protected]

## Templates
> 做一个这样的模版
![模板](http://dn-cnode.qbox.me/Frs_RuLXJxYQgYoIUhGJJ1zspCJE)

## Result
> ## 加数据渲染之后,导出结果
![导出结果](http://dn-cnode.qbox.me/FnRDa5Zyjg-dI7ykCNR0T8SorWyC)

## 捐赠鼓励支持此项目,支付宝扫描:
![捐赠鼓励支持此项目](http://dn-cnode.qbox.me/FucPKV4XWewhakoqTSngU3AsaP0Z)

## 项目贡献人列表
- @Hello World ¥50
- @德爾文 ¥50
- @Explore® ¥50
- @向左转 ¥50
- @吴燕飞 ¥50
- @strive-ming ¥10
- @MR.P ¥16.66
- @不求来生 ¥6.60
- @羊刀 ¥6.66
- @Leo ¥8.88
- @不摇碧莲 ¥6.66
- @天涯海角 ¥10
- @刚刚好 ¥5
- @Aptenodytes forsteri ¥15
- @HHB ¥30
- @Original ¥88.88
- @半日 ¥10
- @狗狗踏青去了 ¥50
- @zzzzzzzz ¥50
- @zzzzzzzz ¥30
- @九尾之狐 ¥66.66
- @亲眼 ¥6.66