Giter Site home page Giter Site logo

ejsexcel's People

Contributors

bryant1410 avatar cangzhen avatar ghost141 avatar kateier avatar kirning avatar sail-sail avatar sylarlong avatar tpsnt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ejsexcel's Issues

升级后列数运算有问题

升级最新版后,发现无法进行 列数 运算了,结果总是为nan。

<%=_row - 1%>
--
<%=_col - 1%>
11
--
NaN

另外,灰常感谢作者的大作,用起来很爽。

renderExcel 方法返回类型与定义不一致,版本3.5.4

定义中返回Buffer
export declare function renderExcel(exlBuf: Buffer, data: any): Buffer;

而实际返回的是Promise 对象。

导致会报以下错误:
(node:338628) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token ;
at Object. (excel_test\node_modules\ejsexcel\ejsExcel.js:1133:26)
at Generator.next ()
at step (excel_test\node_modules\ejsexcel\ejsExcel.js:1:129)
at excel_test\node_modules\ejsexcel\ejsExcel.js:1:306
at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:338628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:338628) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

是否可以添加浏览器支持?

js-xlsx提供一些api可以在浏览器中使用,所以技术上是否可行?感觉只有解压的部分用浏览器api替换掉nodejs的api就可以了,后续解析模板的代码是否用到了nodejs呢?

很奇怪,用绝对路径就报错,相对路径可以。

//'F:\\node-project\\infostation\\dist\\config\\export\\separation.xlsx'
fs.readFile("./separation.xlsx", function (err, exlBuf) {
    if(err){
            console.log('read excel template error:',err);
    } else {
        console.log(exlBuf);
        ejsExcel.renderExcel(exlBuf, data).then(function(exlBuf2) {
        	fs.writeFileSync("./separation2.xlsx", exlBuf2);
        	console.log("生成separation.xlsx");
        }).catch(function(err) {
        	console.error(err);
        });
    }
});

用第一个路径,报错

[2017-10-17 15:45:13.903] [ERROR] mongodb - renderExcel error: { ReferenceError: _data is not defined
    at Object.anonymous (eval at <anonymous> (F:\node-project\infostation\dist\resources\node_modules\ejsExcel\ejsExcel.js:1133:26), <anonymous>:24:9874)
    at next (native)
    at onFulfilled (F:\node-project\infostation\dist\resources\node_modules\ejsExcel\lib\co\index.js:71:17)
    at co (F:\node-project\infostation\dist\resources\node_modules\ejsExcel\lib\co\index.js:56:10)
    at Object.<anonymous> (F:\node-project\infostation\dist\resources\node_modules\ejsExcel\ejsExcel.js:74:14)
    at Object.<anonymous> (F:\node-project\infostation\dist\resources\node_modules\ejsExcel\ejsExcel.js:1134:35)
    at next (native)
    at step (F:\node-project\infostation\dist\resources\node_modules\ejsExcel\ejsExcel.js:1:270)
    at F:\node-project\infostation\dist\resources\node_modules\ejsExcel\ejsExcel.js:1:447
    at process._tickDomainCallback (internal/process/next_tick.js:129:7) is_out: true }

Floating point exception

node 版本 v0.10.1 加载ejsExcel时报这个错误(Floating point exception) node 直接挂掉

ValidationError: "startElement" is not allowed

第一次使用,出现如下报错
包已经是最新版本,使用的脚本和excel也都是官方提供的test文件。

{ ValidationError: "startElement" is not allowed. "endElement" is not allowed. "sanitizeFn" is not allowed at Object.exports.process (/Users/xiaoyun/gitlab/e2e-demo/node_modules/joi/lib/errors.js:154:19) at _validateWithOptions (/Users/xiaoyun/gitlab/e2e-demo/node_modules/joi/lib/any.js:601:31) at root.validate (/Users/xiaoyun/gitlab/e2e-demo/node_modules/joi/lib/index.js:105:23) at Object.module.exports [as toJson] (/Users/xiaoyun/gitlab/e2e-demo/node_modules/xml2json/lib/xml2json.js:152:26) at /Users/xiaoyun/gitlab/e2e-demo/node_modules/ejsexcel/ejsExcel.js:757:29 at next (native) at step (/Users/xiaoyun/gitlab/e2e-demo/node_modules/ejsexcel/ejsExcel.js:1:253) at /Users/xiaoyun/gitlab/e2e-demo/node_modules/ejsexcel/ejsExcel.js:1:430 at process._tickCallback (internal/process/next_tick.js:103:7)

ejsexcel 是不是有本地编译要求,在win下老有问题。

npm info prepublish [email protected]
[email protected] node_modules\ejsexcel
npm info ok

mrlong@mrlong-win10 MINGW64 /c/code/ppms/src
$ node ppmsapp.js

C:\code\ppms\src\node_modules\ejsexcel\ejsExcel.js:190
sheetSufStr = Buffer.from("\n<%\nvar data = _args.data;\nvar charPlus = _args.charPlus;\n
var charToNum = _args.charToNum;\nvar str2Xml = _args.str2Xml;\nvar hid
eSheet
= _args.hideSheet;\nvar showSheet = _args.showSheet;\nvar deleteS
heet
= _args.deleteSheet;\nvar ps = _args.ps;\nvar pi = _args.pi;\nva
r pf = _args.pf;\nvar acVar = _args.acVar;\nvar _r = 0;\nvar _c = 0;\nva
r _row = 0;\nvar _col = "";\nvar _rc = "";\nvar img = _args.img;\nvar q
rcode
= _args.qrcode;\nvar mergeCellArr = [];\nvar mergeCellFn = function
(mclStr) {\n mergeCellArr.push(mclStr);\n};\nvar hyperlinkArr = [];\nvar
outlineLevel = _args.outlineLevel;\n%>");
^
TypeError: this is not a typed array.
at Function.from (native)
at Object. (C:\code\ppms\src\node_modules\ejsexcel\ejsExcel.js:19
0:24)
at Object. (C:\code\ppms\src\node_modules\ejsexcel\ejsExcel.js:15
23:4)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\code\ppms\src\controllers\budget\project\project-i
ndex.js:12:16)

chart

How to set dynamic range for Chart ? like =SUM('H2;H'+(_row-1))

关于循环读取已加载行数据的错误问题

你好!刚开始使用这个ejs导出的时候,效果还是不错的,但是最后还是遇到一个不大不小的问题,就是在循环读取已经打印出来的数据,只读取了模板上的写好的行数据。也就是说如果我有一千多行的数据需要循环导出,模板上就写了三行ejs代码。然后我再次读这张数据的时候,只读取了三行。根据情况,我查找到了问题,在excel表中就已经体现,虽然可以在excel表中可以正常查看数据,但是在你打开该excel表的xml格式文档下,可以发现excel的ref下只有三行数据。也就导致ejsexcel再次读写的时候只有三行数据。在文档中并没有发现你们对row的参数下有相应的处理,所以也是提了个小建议。当然ejsexcel再打印各种复杂的报表是相当便捷好用的,所以也希望ejsexcel能够越来越完善与强大

Error opening department cell data after exporting excel

template
template.xlsx
data
const data = [{ name: '刘桂娟', mustIssue: 6000, realIssue: 4000, date: 'test', project: 'test', team: 'test', total: 'test', personType: 'test', bankAcc: 'test', bankName: 'test' }]

error
1573446610

Some content in Excel has a problem, let us try to recover, if you trust the source of this workbook, click Yes.

可以只指某一个Sheet进行渲染吗?

我有这样一个需要:设置Sheet1中单元格A1 为<%=data.value1%>, 渲染出来的结果为1, 另一个Sheet2中的单元格A2为=Sheet1!A1, 实际上它是一个链接指向了Sheet1中单元格A1,结果也为1,但结果渲染出来的就是数字1,而不是=Sheet1!A1这个链接推算出来的1,我希望这个结果是由=Sheet1!A1这个链接推算出来,有什么办法吗?

时间格式问题

楼主大神你好,

我的需求是:在javascript中current= new Date(), 在excel的单元格里的值是10/07/2019, 但显示成07-Oct 2019. 这种情况怎么做呢?

尝试一:
在javascript 里,时间是:current= new Date(), 写入Excel中时,使用<%~ data.current%>,然后将EXCEL的格式调成 07-Oct 2019,但结果显示 "Mon Oct 07 2019 16:16:41 GMT+0800 (China Standard Time)"

尝试二:
在javascript里,字符串是:current= ‘10/07/2019’, 写入Excel中时,使用<%~ data.current%>,然后将EXCEL的格式调成 07-Oct 2019, 但结果显示是字符串10/07/2019

两种尝试都不符合要求,求大神帮忙

模版里配置了table的样式,生成表格之后table的样式并不会根据内容的行数自动扩张

如题,请问这个可以做得到的吗?
我在模版里用了“format as table”(如图), 因为导进去的数据是不确定有多少行的,格式format只弄在了语法那一行,生成的表里也只有第一行保留了表格式。请问填充数据的时候能够自动应用table format吗?是要从代码里设置?或者我的模版里得写些额外的语法(如果要,该怎么写)?
谢谢

image

同一单元格里变量和字符串共存问题

我在一个单元格里设置了

<%~_data_[0].year%><%="年"%>

像这样
image

data:

const data = [{year: 2019, month: 4}, {name: '小明'}];

然后打印出来变成了这样
image
是我哪里写错了么
mac下
node8.12.0

如何实现嵌套行循环?

例如:
<% forRow item,i in data.orderArr %> <% forRow goods,j in item.arr %><%= goods.name %>

会报错。正确的怎么写?

支持动态列名么

@sail-sail 项目中实际需求是列名是根据数据动态生成的,目前是否支持,如果有,是否有demo?

感谢支持

一个单元格放入多张图片

请教下一个单元格放入多张图片怎么操作,
另外图片有宽高属性参数么,目前好像是充满整个单元格的

Excel Template格式

template里边支持的格式都有哪些啊? 参照test里边那些模版在renderExcel的时候一直报错(如下),过不去啊
error: SyntaxError: Invalid or unexpected token

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.