Comparing version 3.5.2 to 3.5.3
@@ -101,3 +101,3 @@ | ||
buf.push(beforeBuf); | ||
buf.push(';buf.push(new Buffer(\''); | ||
buf.push(';buf.push(Buffer.from(\''); | ||
@@ -115,8 +115,8 @@ var lineno = 1; | ||
if(pixEq === "=" || pixEq === "-" || pixEq === "~" || pixEq === "#") { | ||
prefix = "'));buf.push(new Buffer(String("; | ||
postfix = ")));buf.push(new Buffer('"; | ||
prefix = "'));buf.push(Buffer.from(String("; | ||
postfix = ")));buf.push(Buffer.from('"; | ||
++i; | ||
} else { | ||
prefix = "'));"; | ||
postfix = ";buf.push(new Buffer('"; | ||
postfix = ";buf.push(Buffer.from('"; | ||
} | ||
@@ -123,0 +123,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"name": "ejsexcel", | ||
"version": "3.5.2", | ||
"version": "3.5.3", | ||
"main": "ejsExcel.js", | ||
@@ -8,0 +8,0 @@ "readme": "README.md", |
@@ -18,2 +18,21 @@ ejsExcel | ||
- e.g | ||
```js | ||
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"); | ||
})(); | ||
``` | ||
@@ -52,3 +71,3 @@ ## Syntax | ||
## 捐赠鼓励支持此项目 | ||
## 捐赠鼓励支持此项目,支付宝扫描: | ||
![捐赠鼓励支持此项目](http://dn-cnode.qbox.me/FucPKV4XWewhakoqTSngU3AsaP0Z) | ||
@@ -60,2 +79,7 @@ | ||
- @Explore® ¥50 | ||
- @向左转 ¥50 | ||
- @向左转 ¥50 | ||
- @吴燕飞 ¥50 | ||
- @strive-ming ¥10 | ||
- @MR.P ¥16.66 | ||
- @不求来生 ¥6.60 | ||
- @羊刀 ¥6.66 |
@@ -1,15 +0,16 @@ | ||
var ejsExcel = require("../ejsExcel"); | ||
var fs = require("fs"); | ||
//获得Excel模板的buffer对象 | ||
var exlBuf = fs.readFileSync("./test.xlsx"); | ||
const ejsexcel = require("../ejsExcel"); | ||
const fs = require("fs"); | ||
const util = require("util"); | ||
const readFileAsync = util.promisify(fs.readFile); | ||
const writeFileAsync = util.promisify(fs.writeFile); | ||
//数据源 | ||
var 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模板 | ||
ejsExcel.renderExcel(exlBuf, data).then(function(exlBuf2) { | ||
fs.writeFileSync("./test2.xlsx", exlBuf2); | ||
(async function() { | ||
//获得Excel模板的buffer对象 | ||
const exlBuf = await readFileAsync("./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 ejsexcel.renderExcel(exlBuf, data); | ||
await writeFileAsync("./test2.xlsx", exlBuf2); | ||
console.log("生成test2.xlsx"); | ||
}).catch(function(err) { | ||
console.error(err); | ||
}); | ||
})(); |
@@ -1,16 +0,17 @@ | ||
var ejsExcel = require("../ejsExcel"); | ||
var fs = require("fs"); | ||
//获得Excel模板的buffer对象 | ||
var exlBuf = fs.readFileSync("./report.xlsx"); | ||
const ejsexcel = require("../ejsExcel"); | ||
const fs = require("fs"); | ||
const util = require("util"); | ||
const readFileAsync = util.promisify(fs.readFile); | ||
const writeFileAsync = util.promisify(fs.writeFile); | ||
//数据源 | ||
var data = [ [{"table_name":"现金报表","date": '2014-04-09'}],[ { "cb1":"001","cb1_":"002","bn1":"1","bn1_":"1","cn1":"1","cn1_":"1","num1":"1","num1_":"1", "cb5":"001","cb5_":"002","bn5":"1","bn5_":"1","cn5":"1","cn5_":"1","num1":"1","num5_":"1", "cb10":"001","cb10_":"002","bn10":"1","bn10_":"1","cn10":"1","cn10_":"1","num10":"1","num10_":"1", "cb20":"001","cb20_":"002","bn20":"1","bn20_":"1","cn20":"1","cn20_":"1","num20":"1","num20_":"1", "cb50":"001","cb50_":"002","bn50":"1","bn50_":"1","cn50":"1","cn50_":"1","num50":"1","num50_":"1", "cb100":"001","cb100_":"002","bn100":"1","bn100_":"1","cn100":"1","cn100_":"1","num100":"1","num100_":"1" },{ "cb1":"001","cb1_":"002","bn1":"1","bn1_":"1","cn1":"1","cn1_":"1","num1":"1","num1_":"1", "cb5":"001","cb5_":"002","bn5":"1","bn5_":"1","cn5":"1","cn5_":"1","num1":"1","num5_":"1", "cb10":"001","cb10_":"002","bn10":"1","bn10_":"1","cn10":"1","cn10_":"1","num10":"1","num10_":"1", "cb20":"001","cb20_":"002","bn20":"1","bn20_":"1","cn20":"1","cn20_":"1","num20":"1","num20_":"1", "cb50":"001","cb50_":"002","bn50":"1","bn50_":"1","cn50":"1","cn50_":"1","num50":"1","num50_":"1", "cb100":"001","cb100_":"002","bn100":"1","bn100_":"1","cn100":"1","cn100_":"1","num100":"1","num100_":"1" }]]; | ||
//用数据源(对象)data渲染Excel模板 | ||
ejsExcel.renderExcel(exlBuf, data).then(function(exlBuf2){ | ||
fs.writeFileSync("./report2.xlsx", exlBuf2); | ||
(async function() { | ||
//获得Excel模板的buffer对象 | ||
const exlBuf = await readFileAsync("./report.xlsx"); | ||
//数据源 | ||
const data = [ [{"table_name":"现金报表","date": '2014-04-09'}],[ { "cb1":"001","cb1_":"002","bn1":"1","bn1_":"1","cn1":"1","cn1_":"1","num1":"1","num1_":"1", "cb5":"001","cb5_":"002","bn5":"1","bn5_":"1","cn5":"1","cn5_":"1","num1":"1","num5_":"1", "cb10":"001","cb10_":"002","bn10":"1","bn10_":"1","cn10":"1","cn10_":"1","num10":"1","num10_":"1", "cb20":"001","cb20_":"002","bn20":"1","bn20_":"1","cn20":"1","cn20_":"1","num20":"1","num20_":"1", "cb50":"001","cb50_":"002","bn50":"1","bn50_":"1","cn50":"1","cn50_":"1","num50":"1","num50_":"1", "cb100":"001","cb100_":"002","bn100":"1","bn100_":"1","cn100":"1","cn100_":"1","num100":"1","num100_":"1" },{ "cb1":"001","cb1_":"002","bn1":"1","bn1_":"1","cn1":"1","cn1_":"1","num1":"1","num1_":"1", "cb5":"001","cb5_":"002","bn5":"1","bn5_":"1","cn5":"1","cn5_":"1","num1":"1","num5_":"1", "cb10":"001","cb10_":"002","bn10":"1","bn10_":"1","cn10":"1","cn10_":"1","num10":"1","num10_":"1", "cb20":"001","cb20_":"002","bn20":"1","bn20_":"1","cn20":"1","cn20_":"1","num20":"1","num20_":"1", "cb50":"001","cb50_":"002","bn50":"1","bn50_":"1","cn50":"1","cn50_":"1","num50":"1","num50_":"1", "cb100":"001","cb100_":"002","bn100":"1","bn100_":"1","cn100":"1","cn100_":"1","num100":"1","num100_":"1" }]]; | ||
//用数据源(对象)data渲染Excel模板 | ||
const exlBuf2 = await ejsexcel.renderExcel(exlBuf, data); | ||
await writeFileAsync("./report2.xlsx", exlBuf2); | ||
console.log("生成report2.xlsx"); | ||
}).catch(function(err) { | ||
console.error(err); | ||
}); | ||
})(); | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
320437
47
8104
82