Comparing version 0.14.1 to 0.15.0
@@ -68,2 +68,19 @@ 'use strict'; | ||
cell.z = cell.z || _xlsx2.default.SSF._table[14]; // eslint-disable-line no-underscore-dangle | ||
/* eslint-disable spaced-comment, no-trailing-spaces */ | ||
/*** | ||
* Allows for an non-abstracted representation of the data | ||
* | ||
* example: {t:'n', z:10, f:'=AVERAGE(A:A)'} | ||
* | ||
* Documentation: | ||
* - Cell Object: https://sheetjs.gitbooks.io/docs/#cell-object | ||
* - Data Types: https://sheetjs.gitbooks.io/docs/#data-types | ||
* - Format: https://sheetjs.gitbooks.io/docs/#number-formats | ||
**/ | ||
/* eslint-disable spaced-comment, no-trailing-spaces */ | ||
} else if (isObject(cell.v)) { | ||
cell.t = cell.v.t; | ||
cell.f = cell.v.f; | ||
cell.z = cell.v.z; | ||
} else { | ||
@@ -70,0 +87,0 @@ cell.t = 's'; |
{ | ||
"name": "node-xlsx", | ||
"author": "Olivier Louvignes <olivier@mg-crea.com>", | ||
"version": "0.14.1", | ||
"version": "0.15.0", | ||
"description": "NodeJS Excel files parser & builder", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -50,5 +50,5 @@ # Node XLSX | ||
const data = [[1, 2, 3], [true, false, null, 'sheetjs'], ['foo', 'bar', new Date('2014-02-19T14:30Z'), '0.3'], ['baz', null, 'qux']] | ||
const option = {'!cols': [{ wch: 6 }, { wch: 7 }, { wch: 10 }, { wch: 20 } ]}; | ||
const options = {'!cols': [{ wch: 6 }, { wch: 7 }, { wch: 10 }, { wch: 20 } ]}; | ||
var buffer = xlsx.build([{name: "mySheetName", data: data}], option); // Returns a buffer | ||
var buffer = xlsx.build([{name: "mySheetName", data: data}], options); // Returns a buffer | ||
``` | ||
@@ -63,5 +63,5 @@ | ||
const range = {s: {c: 0, r:0 }, e: {c:0, r:3}}; // A1:A4 | ||
const option = {'!merges': [ range ]}; | ||
const options = {'!merges': [ range ]}; | ||
var buffer = xlsx.build([{name: "mySheetName", data: data}], option); // Returns a buffer | ||
var buffer = xlsx.build([{name: "mySheetName", data: data}], options); // Returns a buffer | ||
``` | ||
@@ -77,5 +77,5 @@ | ||
const range = {s: {c: 0, r:0 }, e: {c:0, r:3}}; // A1:A4 | ||
const option = {'!merges': [ range ]}; | ||
const sheetOptions = {'!merges': [ range ]}; | ||
var buffer = xlsx.build([{name: "myFirstSheet", data: dataSheet1}, {name: "mySecondSheet", data: dataSheet2, options: options}]); // Returns a buffer | ||
var buffer = xlsx.build([{name: "myFirstSheet", data: dataSheet1}, {name: "mySecondSheet", data: dataSheet2, options: sheetOptions}]); // Returns a buffer | ||
``` | ||
@@ -85,2 +85,18 @@ _Beware that if you try to merge several times the same cell, your xlsx file will be seen as corrupted._ | ||
* Using Primitive Object Notation | ||
Data values can also be specified in a non-abstracted representation. | ||
Examples: | ||
```js | ||
const rowAverage = [[{t:'n', z:10, f:'=AVERAGE(2:2)'}], [1,2,3]; | ||
var buffer = xlsx.build([{name: "Average Formula", data: rowAverage}]); | ||
``` | ||
Refer to [xlsx](https://sheetjs.gitbooks.io) documentation for valid structure and values: | ||
- Cell Object: https://sheetjs.gitbooks.io/docs/#cell-object | ||
- Data Types: https://sheetjs.gitbooks.io/docs/#data-types | ||
- Format: https://sheetjs.gitbooks.io/docs/#number-formats | ||
### Troubleshooting | ||
@@ -87,0 +103,0 @@ |
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
24629
147
156