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]);