Skip to content

Commit

Permalink
enhance cell customization - add data-base64-xlsx-cell-config
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanoook committed Dec 10, 2020
1 parent e104d08 commit 6688ffc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/index.js
Expand Up @@ -136,6 +136,19 @@ module.exports = (html, callback, options = {}) => {
cell.hMerge = cs - 1;
}

// In case you need the flexibility to config all possible
// _value, formula, numFmt, cellType...
const dataBase64CellConfig = $td.attr('data-base64-xlsx-cell-config');
if (dataBase64CellConfig) {
try {
const configString = Buffer.from(dataBase64CellConfig, 'base64').toString('utf-8');
Object.assign(cell, JSON.parse(configString));
} catch (e) {
console.error(configString);
console.error(e);
}
}

for (let r = 0; r < rs; r++) {
if (offsets[hi + r] === undefined) {
offsets[hi + r] = 0;
Expand Down

0 comments on commit 6688ffc

Please sign in to comment.