forked from sheetjs/sheetjs
SheetJS
ab2ecebac9
- basic support for parsing BIFF2-4 - basic support for writing BIFF2 - cleaned up some bad substr uses for IE6 compatibility - added flow type annotations for xlsx.flow.js - added numerous null guards (fixes #255 h/t @martinheidegger) - README cleanup (fixes #539 h/t @oliversalzburg) - pin jszip to local version (closes #408 h/t @limouri) bower issues: | id | author | comment | |-----:|:------------------|:------------------------------------------| | #254 | @kkirsche | fixes #254 by removing version from json | | #165 | @vincentcialdella | fixes #165 by changing default script | | #180 | @owencraig | fixes #180 by using xlsx.core.min.js | format issues: | id | author | comment | |-----:|:------------------|:------------------------------------------| | #271 | @morstaine | fixes #271 by reworking related parse fns | | #504 | @JanSchuermannPH | fixes #504 detect FullPaths h/t @Mithgol | | #508 | @basma-emad | fixes #508 offending file used `x:` NS |
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
function fix_opts_func(defaults/*:Array<Array<any> >*/)/*:{(o:any):void}*/ {
|
|
return function fix_opts(opts) {
|
|
for(var i = 0; i != defaults.length; ++i) {
|
|
var d = defaults[i];
|
|
if(opts[d[0]] === undefined) opts[d[0]] = d[1];
|
|
if(d[2] === 'n') opts[d[0]] = Number(opts[d[0]]);
|
|
}
|
|
};
|
|
}
|
|
|
|
var fix_read_opts = fix_opts_func([
|
|
['cellNF', false], /* emit cell number format string as .z */
|
|
['cellHTML', true], /* emit html string as .h */
|
|
['cellFormula', true], /* emit formulae as .f */
|
|
['cellStyles', false], /* emits style/theme as .s */
|
|
['cellDates', false], /* emit date cells with type `d` */
|
|
|
|
['sheetStubs', false], /* emit empty cells */
|
|
['sheetRows', 0, 'n'], /* read n rows (0 = read all rows) */
|
|
|
|
['bookDeps', false], /* parse calculation chains */
|
|
['bookSheets', false], /* only try to get sheet names (no Sheets) */
|
|
['bookProps', false], /* only try to get properties (no Sheets) */
|
|
['bookFiles', false], /* include raw file structure (keys, files, cfb) */
|
|
['bookVBA', false], /* include vba raw data (vbaraw) */
|
|
|
|
['password',''], /* password */
|
|
['WTF', false] /* WTF mode (throws errors) */
|
|
]);
|
|
|
|
|
|
var fix_write_opts = fix_opts_func([
|
|
['cellDates', false], /* write date cells with type `d` */
|
|
|
|
['bookSST', false], /* Generate Shared String Table */
|
|
|
|
['bookType', 'xlsx'], /* Type of workbook (xlsx/m/b) */
|
|
|
|
['compression', false], /* Use file compression */
|
|
|
|
['WTF', false] /* WTF mode (throws errors) */
|
|
]);
|