sheetjs-clone/bits/88_write.js
SheetJS e1f8dbb863 version bump 0.7.2: bughunt
- read BOM, handle UTF16LE-encoded XML
- handle namespaces in [Content_Types].xml
- parse workbook rels to determine sheet files
- numbers OSX boolean support (apparently requires "0" or "1")
- XLSX force "General" style to be serialized, omit implied cell type and style
- updated SSF to 0.7.0 (h/t @sysarchitect)
- updated jszip to 2.2.2
- removed old tests/files path, replaced with test_files
- themes written
- ignore potential existence of thumbnail when calculating relationship ids
2014-05-22 05:16:51 -07:00

23 lines
669 B
JavaScript

function writeSync(wb, opts) {
var o = opts||{};
var z = write_zip(wb, o);
switch(o.type) {
case "base64": return z.generate({type:"base64"});
case "binary": return z.generate({type:"string"});
case "buffer": return z.generate({type:"nodebuffer"});
case "file": return _fs.writeFileSync(o.file, z.generate({type:"nodebuffer"}));
default: throw new Error("Unrecognized type " + o.type);
}
}
function writeFileSync(wb, filename, opts) {
var o = opts||{}; o.type = 'file';
o.file = filename;
switch(o.file.substr(-5).toLowerCase()) {
case '.xlsm': o.bookType = 'xlsm'; break;
case '.xlsb': o.bookType = 'xlsb'; break;
}
return writeSync(wb, o);
}