forked from sheetjs/sheetjs
SheetJS
d7ecca0e8b
- BIFF 2-12 formula parsing - more content type coverage - unified `.f` form: A1-style string - `.F` field for array formulae - formula output groups array formulae - bin script -A --arrays output JS row objects - whitespace robustness in inline string xml - UTF-8 parsing in rich text runs (fixes #505 h/t @fuchsc) - bold/italic/underline accept null val attr (h/t @qqilihq) - sst trimming (fixes #176 h/t @shakhal @oising)
30 lines
760 B
JavaScript
30 lines
760 B
JavaScript
function write_ods(wb/*:any*/, opts/*:any*/) {
|
|
/*:: if(!jszip) throw new Error("JSZip is not available"); */
|
|
var zip = new jszip();
|
|
var f = "";
|
|
|
|
var manifest/*:Array<Array<string> >*/ = [];
|
|
var rdf = [];
|
|
|
|
/* 3:3.3 and 2:2.2.4 */
|
|
f = "mimetype";
|
|
zip.file(f, "application/vnd.oasis.opendocument.spreadsheet");
|
|
|
|
/* Part 1 Section 2.2 Documents */
|
|
f = "content.xml";
|
|
zip.file(f, write_content_xml(wb, opts));
|
|
manifest.push([f, "text/xml"]);
|
|
rdf.push([f, "ContentFile"]);
|
|
|
|
/* Part 3 Section 6 Metadata Manifest File */
|
|
f = "manifest.rdf";
|
|
zip.file(f, write_rdf(rdf, opts));
|
|
manifest.push([f, "application/rdf+xml"]);
|
|
|
|
/* Part 3 Section 4 Manifest File */
|
|
f = "META-INF/manifest.xml";
|
|
zip.file(f, write_manifest(manifest, opts));
|
|
|
|
return zip;
|
|
}
|