From cbbda17f21187c3f498d726adc4e712bdf7db8ef Mon Sep 17 00:00:00 2001 From: Acathur Date: Thu, 9 Nov 2017 21:57:20 -0600 Subject: [PATCH] add option: fieldNames --- lib/json2xls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/json2xls.js b/lib/json2xls.js index e0a7a07..3b6e74e 100644 --- a/lib/json2xls.js +++ b/lib/json2xls.js @@ -53,10 +53,11 @@ transform.prepareJson = function(json,config) { }); fields = Object.keys(fields); } + var fieldNames = conf.fieldNames || fields //cols res.cols = fields.map(function(key,i) { return { - caption: key, + caption: fieldNames[i], type: getType(jsonArr[0][key],types[i]), beforeCellWrite: function(row, cellData, eOpt){ eOpt.cellType = getType(cellData,types[i]);