forked from sheetjs/sheetjs
XLSB/XLS Record Name refactor
This commit is contained in:
parent
02707848ad
commit
b9e7d0d8f4
15
README.md
15
README.md
@ -229,6 +229,10 @@ import * as XLSX from 'xlsx/xlsx.mjs';
|
||||
import * as fs from 'fs';
|
||||
XLSX.set_fs(fs);
|
||||
|
||||
/* load 'stream' for stream support */
|
||||
import { Readable } from 'stream';
|
||||
XLSX.stream.set_readable(Readable);
|
||||
|
||||
/* load the codepage support library for extended support with older formats */
|
||||
import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs';
|
||||
XLSX.set_cptable(cpexcel);
|
||||
@ -1708,8 +1712,8 @@ The [included demos](demos/) cover mobile apps and other special deployments.
|
||||
### Streaming Write
|
||||
|
||||
The streaming write functions are available in the `XLSX.stream` object. They
|
||||
take the same arguments as the normal write functions but return a Readable
|
||||
Stream. They are only exposed in NodeJS.
|
||||
take the same arguments as the normal write functions but return a NodeJS
|
||||
Readable Stream.
|
||||
|
||||
- `XLSX.stream.to_csv` is the streaming version of `XLSX.utils.sheet_to_csv`.
|
||||
- `XLSX.stream.to_html` is the streaming version of `XLSX.utils.sheet_to_html`.
|
||||
@ -3822,8 +3826,11 @@ takes an options argument:
|
||||
| array of strings | Use specified strings as keys in row objects |
|
||||
| (default) | Read and disambiguate first row as keys |
|
||||
|
||||
If header is not `1`, the row object will contain the non-enumerable property
|
||||
`__rowNum__` that represents the row of the sheet corresponding to the entry.
|
||||
- If header is not `1`, the row object will contain the non-enumerable property
|
||||
`__rowNum__` that represents the row of the sheet corresponding to the entry.
|
||||
- If header is an array, the keys will not be disambiguated. This can lead to
|
||||
unexpected results if the array values are not unique!
|
||||
|
||||
|
||||
<details>
|
||||
<summary><b>Examples</b> (click to show)</summary>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W041 */
|
||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||
function make_ssf(SSF/*:SSFModule*/){
|
||||
SSF.version = '0.11.2';
|
||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
@ -983,5 +983,5 @@ SSF.load_table = function load_table(tbl/*:SSFTable*/)/*:void*/ {
|
||||
};
|
||||
SSF.init_table = init_table;
|
||||
SSF.format = format;
|
||||
};
|
||||
}
|
||||
make_ssf(SSF);
|
||||
|
@ -40,7 +40,8 @@ type CFBFiles = {[n:string]:CFBEntry};
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported CRC32 */
|
||||
var CRC32 = (function(CRC32) {
|
||||
var CRC32 = /*#__PURE__*/(function() {
|
||||
var CRC32 = {};
|
||||
CRC32.version = '1.2.0';
|
||||
/* see perf/crc32table.js */
|
||||
/*global Int32Array */
|
||||
@ -129,9 +130,9 @@ CRC32.bstr = crc32_bstr;
|
||||
CRC32.buf = crc32_buf;
|
||||
CRC32.str = crc32_str;
|
||||
return CRC32;
|
||||
})({});
|
||||
})();
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var CFB = /*#__PURE__*/(function _CFB(){
|
||||
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
|
||||
exports.version = '1.2.1';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
@ -1064,7 +1065,7 @@ if(!use_typed_arrays) {
|
||||
for(; i<=279; i++) clens.push(7);
|
||||
for(; i<=287; i++) clens.push(8);
|
||||
build_tree(clens, fix_lmap, 288);
|
||||
})();var _deflateRaw = (function _deflateRawIIFE() {
|
||||
})();var _deflateRaw = /*#__PURE__*/(function _deflateRawIIFE() {
|
||||
var DST_LN_RE = use_typed_arrays ? new Uint8Array(0x8000) : [];
|
||||
var j = 0, k = 0;
|
||||
for(; j < DST_LN.length - 1; ++j) {
|
||||
|
@ -46,7 +46,7 @@ var rencoding = evert(encodings);
|
||||
//var rencstr = "&<>'\"".split("");
|
||||
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml/*:StringConv*/ = (function() {
|
||||
var unescapexml/*:StringConv*/ = /*#__PURE__*/(function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text/*:string*/)/*:string*/ {
|
||||
@ -76,14 +76,12 @@ function escapexlml(text/*:string*/)/*:string*/{
|
||||
}
|
||||
|
||||
/* TODO: handle codepages */
|
||||
var xlml_fixstr/*:StringConv*/ = (function() {
|
||||
var xlml_fixstr/*:StringConv*/ = /*#__PURE__*/(function() {
|
||||
var entregex = /&#(\d+);/g;
|
||||
function entrepl($$/*:string*/,$1/*:string*/)/*:string*/ { return String.fromCharCode(parseInt($1,10)); }
|
||||
return function xlml_fixstr(str/*:string*/)/*:string*/ { return str.replace(entregex,entrepl); };
|
||||
})();
|
||||
var xlml_unfixstr/*:StringConv*/ = (function() {
|
||||
return function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); };
|
||||
})();
|
||||
function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); };
|
||||
|
||||
function parsexmlbool(value/*:any*/)/*:boolean*/ {
|
||||
switch(value) {
|
||||
@ -162,7 +160,7 @@ if(has_buf) {
|
||||
}
|
||||
|
||||
// matches <foo>...</foo> extracts content
|
||||
var matchtag = (function() {
|
||||
var matchtag = /*#__PURE__*/(function() {
|
||||
var mtcache/*:{[k:string]:RegExp}*/ = ({}/*:any*/);
|
||||
return function matchtag(f/*:string*/,g/*:?string*/)/*:RegExp*/ {
|
||||
var t = f+"|"+(g||"");
|
||||
@ -171,7 +169,7 @@ var matchtag = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
var htmldecode/*:{(s:string):string}*/ = (function() {
|
||||
var htmldecode/*:{(s:string):string}*/ = /*#__PURE__*/(function() {
|
||||
var entities/*:Array<[RegExp, string]>*/ = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
@ -195,7 +193,7 @@ var htmldecode/*:{(s:string):string}*/ = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
var vtregex = (function(){ var vt_cache = {};
|
||||
var vtregex = /*#__PURE__*/(function(){ var vt_cache = {};
|
||||
return function vt_regex(bt) {
|
||||
if(vt_cache[bt] !== undefined) return vt_cache[bt];
|
||||
return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)</(?:vt:)?" + bt + ">", 'g') );
|
||||
@ -250,6 +248,11 @@ var xlmlregex = /<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/][^>]*)?>/mg;
|
||||
//var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/mg;
|
||||
|
||||
var XMLNS = ({
|
||||
CORE_PROPS: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
|
||||
CUST_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
|
||||
EXT_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",
|
||||
CT: 'http://schemas.openxmlformats.org/package/2006/content-types',
|
||||
RELS: 'http://schemas.openxmlformats.org/package/2006/relationships',
|
||||
'dc': 'http://purl.org/dc/elements/1.1/',
|
||||
'dcterms': 'http://purl.org/dc/terms/',
|
||||
'dcmitype': 'http://purl.org/dc/dcmitype/',
|
||||
@ -261,7 +264,7 @@ var XMLNS = ({
|
||||
'xsd': 'http://www.w3.org/2001/XMLSchema'
|
||||
}/*:any*/);
|
||||
|
||||
XMLNS.main = [
|
||||
var XMLNS_main = [
|
||||
'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
|
||||
'http://purl.oclc.org/ooxml/spreadsheetml/main',
|
||||
'http://schemas.microsoft.com/office/excel/2006/main',
|
||||
|
@ -14,7 +14,7 @@ function recordhopper(data, cb/*:RecordHopperCB*/, opts/*:?any*/) {
|
||||
tgt = data.l + length;
|
||||
var d = R.f && R.f(data, length, opts);
|
||||
data.l = tgt;
|
||||
if(cb(d, R.n, RT)) return;
|
||||
if(cb(d, R, RT)) return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,9 +52,8 @@ function buf_array()/*:BufArray*/ {
|
||||
return ({ next:next, push:push, end:end, _bufs:bufs }/*:any*/);
|
||||
}
|
||||
|
||||
function write_record(ba/*:BufArray*/, type/*:string*/, payload, length/*:?number*/) {
|
||||
if(!XLSBRE) make_XLSBRE();
|
||||
var t/*:number*/ = +XLSBRE[type], l;
|
||||
function write_record(ba/*:BufArray*/, type/*:number*/, payload, length/*:?number*/) {
|
||||
var t/*:number*/ = +type, l;
|
||||
if(isNaN(t)) return; // TODO: throw something here?
|
||||
if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0;
|
||||
l = 1 + (t >= 0x80 ? 1 : 0) + 1/* + length*/;
|
||||
|
@ -5,14 +5,38 @@
|
||||
var ct2type/*{[string]:string}*/ = ({
|
||||
/* Workbook */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
|
||||
"application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
|
||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
|
||||
"application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
|
||||
|
||||
/* Worksheet */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
|
||||
"application/vnd.ms-excel.worksheet": "sheets",
|
||||
"application/vnd.ms-excel.binIndexWs": "TODO", /* Binary Index */
|
||||
|
||||
/* Chartsheet */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
|
||||
"application/vnd.ms-excel.chartsheet": "charts",
|
||||
|
||||
/* Macrosheet */
|
||||
"application/vnd.ms-excel.macrosheet+xml": "macros",
|
||||
"application/vnd.ms-excel.macrosheet": "macros",
|
||||
"application/vnd.ms-excel.intlmacrosheet": "TODO",
|
||||
"application/vnd.ms-excel.binIndexMs": "TODO", /* Binary Index */
|
||||
|
||||
/* Dialogsheet */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
|
||||
"application/vnd.ms-excel.dialogsheet": "dialogs",
|
||||
|
||||
/* Shared Strings */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
|
||||
"application/vnd.ms-excel.sharedStrings": "strs",
|
||||
|
||||
/* Styles */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
|
||||
"application/vnd.ms-excel.styles": "styles",
|
||||
|
||||
/* File Properties */
|
||||
"application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
|
||||
"application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
|
||||
@ -22,6 +46,14 @@ var ct2type/*{[string]:string}*/ = ({
|
||||
"application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO",
|
||||
|
||||
/* Comments */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
|
||||
"application/vnd.ms-excel.comments": "comments",
|
||||
|
||||
/* Metadata (Stock/Geography and Dynamic Array) */
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
|
||||
"application/vnd.ms-excel.sheetMetadata": "metadata",
|
||||
|
||||
/* PivotTable */
|
||||
"application/vnd.ms-excel.pivotTable": "TODO",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO",
|
||||
@ -146,8 +178,7 @@ var ct2type/*{[string]:string}*/ = ({
|
||||
"sheet": "js"
|
||||
}/*:any*/);
|
||||
|
||||
var CT_LIST = (function(){
|
||||
var o = {
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
@ -187,15 +218,7 @@ var CT_LIST = (function(){
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
keys(o).forEach(function(k) { ["xlsm", "xlam"].forEach(function(v) { if(!o[k][v]) o[k][v] = o[k].xlsx; }); });
|
||||
keys(o).forEach(function(k){ keys(o[k]).forEach(function(v) { ct2type[o[k][v]] = k; }); });
|
||||
return o;
|
||||
})();
|
||||
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
XMLNS.CT = 'http://schemas.openxmlformats.org/package/2006/content-types';
|
||||
};
|
||||
|
||||
function new_ct()/*:any*/ {
|
||||
return ({
|
||||
@ -250,12 +273,14 @@ var CTYPE_DEFAULTS = [
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', type2ct.rels[0]]
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
});
|
||||
|
||||
function write_ct(ct, opts)/*:string*/ {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o/*:Array<string>*/ = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = (CTYPE_XML_ROOT);
|
||||
@ -267,7 +292,7 @@ function write_ct(ct, opts)/*:string*/ {
|
||||
v = ct[w][0];
|
||||
o[o.length] = (writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx']
|
||||
}));
|
||||
}
|
||||
};
|
||||
@ -277,7 +302,7 @@ function write_ct(ct, opts)/*:string*/ {
|
||||
(ct[w]||[]).forEach(function(v) {
|
||||
o[o.length] = (writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx']
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
@ -40,7 +40,6 @@ function parse_rels(data/*:?string*/, currentFilePath/*:string*/) {
|
||||
return rels;
|
||||
}
|
||||
|
||||
XMLNS.RELS = 'http://schemas.openxmlformats.org/package/2006/relationships';
|
||||
|
||||
var RELS_ROOT = writextag('Relationships', null, {
|
||||
//'xmlns:ns0': XMLNS.RELS,
|
||||
|
@ -56,10 +56,7 @@ function write_rdf(rdf) {
|
||||
return o.join("");
|
||||
}
|
||||
/* TODO: pull properties */
|
||||
var write_meta_ods/*:{(wb:Workbook, opts:any):string}*/ = (function() {
|
||||
var payload = '<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>Sheet' + 'JS ' + XLSX.version + '</meta:generator></office:meta></office:document-meta>';
|
||||
return function wmo(/*:: wb: Workbook, opts: any*/)/*:string*/ {
|
||||
return payload;
|
||||
};
|
||||
})();
|
||||
function write_meta_ods(/*:: wb: Workbook, opts: any*/)/*:string*/ {
|
||||
return '<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>Sheet' + 'JS ' + XLSX.version + '</meta:generator></office:meta></office:document-meta>';
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,9 @@ var CORE_PROPS/*:Array<Array<string> >*/ = [
|
||||
["dcterms:modified", "ModifiedDate", 'date']
|
||||
];
|
||||
|
||||
XMLNS.CORE_PROPS = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties";
|
||||
RELS.CORE_PROPS = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties';
|
||||
|
||||
var CORE_PROPS_REGEX/*:Array<RegExp>*/ = (function() {
|
||||
var CORE_PROPS_REGEX/*:Array<RegExp>*/ = /*#__PURE__*/(function() {
|
||||
var r = new Array(CORE_PROPS.length);
|
||||
for(var i = 0; i < CORE_PROPS.length; ++i) {
|
||||
var f = CORE_PROPS[i];
|
||||
|
@ -14,7 +14,6 @@ var EXT_PROPS/*:Array<Array<string> >*/ = [
|
||||
["TitlesOfParts", "TitlesOfParts", "raw"]
|
||||
];
|
||||
|
||||
XMLNS.EXT_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
|
||||
RELS.EXT_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties';
|
||||
|
||||
var PseudoPropsPairs = [
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* 15.2.12.2 Custom File Properties Part */
|
||||
XMLNS.CUST_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties";
|
||||
RELS.CUST_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties';
|
||||
|
||||
var custregex = /<[^>]+>[^<]*/g;
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* from js-harb (C) 2014-present SheetJS */
|
||||
var DBF = (function() {
|
||||
var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5];
|
||||
var DBF = /*#__PURE__*/(function() {
|
||||
var dbf_codepage_map = {
|
||||
/* Code Pages Supported by Visual FoxPro */
|
||||
/*::[*/0x01/*::]*/: 437, /*::[*/0x02/*::]*/: 850,
|
||||
@ -57,7 +58,6 @@ var dbf_reverse_map = evert({
|
||||
/*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253,
|
||||
/*::[*/0x00/*::]*/: 20127
|
||||
});
|
||||
var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5];
|
||||
/* TODO: find an actual specification */
|
||||
function dbf_to_aoa(buf, opts)/*:AOA*/ {
|
||||
var out/*:AOA*/ = [];
|
||||
@ -359,14 +359,13 @@ function sheet_to_dbf(ws/*:Worksheet*/, opts/*:WriteOpts*/) {
|
||||
return ba.end();
|
||||
}
|
||||
return {
|
||||
versions: DBF_SUPPORTED_VERSIONS,
|
||||
to_workbook: dbf_to_workbook,
|
||||
to_sheet: dbf_to_sheet,
|
||||
from_sheet: sheet_to_dbf
|
||||
};
|
||||
})();
|
||||
|
||||
var SYLK = (function() {
|
||||
var SYLK = /*#__PURE__*/(function() {
|
||||
/* TODO: stress test sequences */
|
||||
var sylk_escapes = ({
|
||||
AA:'À', BA:'Á', CA:'Â', DA:195, HA:'Ä', JA:197,
|
||||
@ -595,7 +594,7 @@ var SYLK = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
var DIF = (function() {
|
||||
var DIF = /*#__PURE__*/(function() {
|
||||
function dif_to_aoa(d/*:RawData*/, opts)/*:AOA*/ {
|
||||
switch(opts.type) {
|
||||
case 'base64': return dif_to_aoa_str(Base64.decode(d), opts);
|
||||
@ -644,7 +643,7 @@ var DIF = (function() {
|
||||
function dif_to_sheet(str/*:string*/, opts)/*:Worksheet*/ { return aoa_to_sheet(dif_to_aoa(str, opts), opts); }
|
||||
function dif_to_workbook(str/*:string*/, opts)/*:Workbook*/ { return sheet_to_workbook(dif_to_sheet(str, opts), opts); }
|
||||
|
||||
var sheet_to_dif = (function() {
|
||||
var sheet_to_dif = /*#__PURE__*/(function() {
|
||||
var push_field = function pf(o/*:Array<string>*/, topic/*:string*/, v/*:number*/, n/*:number*/, s/*:string*/) {
|
||||
o.push(topic);
|
||||
o.push(v + "," + n);
|
||||
@ -707,7 +706,7 @@ var DIF = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
var ETH = (function() {
|
||||
var ETH = /*#__PURE__*/(function() {
|
||||
function decode(s/*:string*/)/*:string*/ { return s.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,"\n"); }
|
||||
function encode(s/*:string*/)/*:string*/ { return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g,"\\n"); }
|
||||
|
||||
@ -807,7 +806,7 @@ var ETH = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
var PRN = (function() {
|
||||
var PRN = /*#__PURE__*/(function() {
|
||||
function set_text_arr(data/*:string*/, arr/*:AOA*/, R/*:number*/, C/*:number*/, o/*:any*/) {
|
||||
if(o.raw) arr[R][C] = data;
|
||||
else if(data === ""){/* empty */}
|
||||
|
@ -1,4 +1,4 @@
|
||||
var WK_ = /*#__PURE__*/ (function() {
|
||||
var WK_ = /*#__PURE__*/(function() {
|
||||
function lotushopper(data, cb/*:RecordHopperCB*/, opts/*:any*/) {
|
||||
if(!data) return;
|
||||
prep_blob(data, data.l || 0);
|
||||
|
@ -106,7 +106,7 @@ function parse_rpr(rpr) {
|
||||
return font;
|
||||
}
|
||||
|
||||
var parse_rs = (function() {
|
||||
var parse_rs = /*#__PURE__*/(function() {
|
||||
var tregex = matchtag("t"), rpregex = matchtag("rPr");
|
||||
/* 18.4.4 r CT_RElt */
|
||||
function parse_r(r) {
|
||||
@ -127,7 +127,7 @@ var parse_rs = (function() {
|
||||
|
||||
|
||||
/* Parse a list of <r> tags */
|
||||
var rs_to_html = (function parse_rs_factory() {
|
||||
var rs_to_html = /*#__PURE__*/(function parse_rs_factory() {
|
||||
var nlregex = /(\r\n|\n)/g;
|
||||
function parse_rpr2(font, intro, outro) {
|
||||
var style/*:Array<string>*/ = [];
|
||||
@ -219,7 +219,7 @@ function write_sst_xml(sst/*:SST*/, opts)/*:string*/ {
|
||||
if(!opts.bookSST) return "";
|
||||
var o = [XML_HEADER];
|
||||
o[o.length] = (writextag('sst', null, {
|
||||
xmlns: XMLNS.main[0],
|
||||
xmlns: XMLNS_main[0],
|
||||
count: sst.Count,
|
||||
uniqueCount: sst.Unique
|
||||
}));
|
||||
|
@ -7,24 +7,23 @@ function parse_BrtBeginSst(data) {
|
||||
function parse_sst_bin(data, opts)/*:SST*/ {
|
||||
var s/*:SST*/ = ([]/*:any*/);
|
||||
var pass = false;
|
||||
recordhopper(data, function hopper_sst(val, R_n, RT) {
|
||||
recordhopper(data, function hopper_sst(val, R, RT) {
|
||||
switch(RT) {
|
||||
case 0x009F: /* 'BrtBeginSst' */
|
||||
case 0x009F: /* BrtBeginSst */
|
||||
s.Count = val[0]; s.Unique = val[1]; break;
|
||||
case 0x0013: /* 'BrtSSTItem' */
|
||||
case 0x0013: /* BrtSSTItem */
|
||||
s.push(val); break;
|
||||
case 0x00A0: /* 'BrtEndSst' */
|
||||
case 0x00A0: /* BrtEndSst */
|
||||
return true;
|
||||
|
||||
case 0x0023: /* 'BrtFRTBegin' */
|
||||
case 0x0023: /* BrtFRTBegin */
|
||||
pass = true; break;
|
||||
case 0x0024: /* 'BrtFRTEnd' */
|
||||
case 0x0024: /* BrtFRTEnd */
|
||||
pass = false; break;
|
||||
|
||||
default:
|
||||
if(R_n.indexOf("Begin") > 0){/* empty */}
|
||||
else if(R_n.indexOf("End") > 0){/* empty */}
|
||||
if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T){}
|
||||
if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return s;
|
||||
@ -41,9 +40,9 @@ var write_BrtSSTItem = write_RichStr;
|
||||
|
||||
function write_sst_bin(sst/*::, opts*/) {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginSst", write_BrtBeginSst(sst));
|
||||
for(var i = 0; i < sst.length; ++i) write_record(ba, "BrtSSTItem", write_BrtSSTItem(sst[i]));
|
||||
write_record(ba, 0x009F /* BrtBeginSst */, write_BrtBeginSst(sst));
|
||||
for(var i = 0; i < sst.length; ++i) write_record(ba, 0x0013 /* BrtSSTItem */, write_BrtSSTItem(sst[i]));
|
||||
/* FRTSST */
|
||||
write_record(ba, "BrtEndSst");
|
||||
write_record(ba, 0x00A0 /* BrtEndSst */);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ function crypto_CreatePasswordVerifier_Method1(Password/*:string*/) {
|
||||
}
|
||||
|
||||
/* [MS-OFFCRYPTO] 2.3.7.2 Binary Document XOR Array Initialization */
|
||||
var crypto_CreateXorArray_Method1 = (function() {
|
||||
var crypto_CreateXorArray_Method1 = /*#__PURE__*/(function() {
|
||||
var PadArray = [0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80, 0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00];
|
||||
var InitialCode = [0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE, 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A, 0x4EC3];
|
||||
var XorMatrix = [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09, 0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF, 0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0, 0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40, 0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5, 0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A, 0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9, 0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0, 0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC, 0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10, 0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168, 0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C, 0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD, 0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC, 0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4];
|
||||
|
@ -1,4 +1,4 @@
|
||||
var RTF = (function() {
|
||||
var RTF = /*#__PURE__*/(function() {
|
||||
function rtf_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ {
|
||||
switch(opts.type) {
|
||||
case 'base64': return rtf_to_sheet_str(Base64.decode(d), opts);
|
||||
|
@ -369,7 +369,7 @@ function write_cellXfs(cellXfs)/*:string*/ {
|
||||
}
|
||||
|
||||
/* 18.8 Styles CT_Stylesheet*/
|
||||
var parse_sty_xml= (function make_pstyx() {
|
||||
var parse_sty_xml= /*#__PURE__*/(function make_pstyx() {
|
||||
var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/;
|
||||
var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/;
|
||||
var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/;
|
||||
@ -414,7 +414,7 @@ RELS.STY = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/
|
||||
|
||||
function write_sty_xml(wb/*:Workbook*/, opts)/*:string*/ {
|
||||
var o = [XML_HEADER, writextag('styleSheet', null, {
|
||||
'xmlns': XMLNS.main[0],
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:vt': XMLNS.vt
|
||||
})], w;
|
||||
if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w;
|
||||
|
@ -211,54 +211,54 @@ function parse_sty_bin(data, themes, opts) {
|
||||
styles.Fonts = [];
|
||||
var state/*:Array<string>*/ = [];
|
||||
var pass = false;
|
||||
recordhopper(data, function hopper_sty(val, R_n, RT) {
|
||||
recordhopper(data, function hopper_sty(val, R, RT) {
|
||||
switch(RT) {
|
||||
case 0x002C: /* 'BrtFmt' */
|
||||
case 0x002C: /* BrtFmt */
|
||||
styles.NumberFmt[val[0]] = val[1]; SSF.load(val[1], val[0]);
|
||||
break;
|
||||
case 0x002B: /* 'BrtFont' */
|
||||
case 0x002B: /* BrtFont */
|
||||
styles.Fonts.push(val);
|
||||
if(val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) {
|
||||
val.color.rgb = rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb, val.color.tint || 0);
|
||||
}
|
||||
break;
|
||||
case 0x0401: /* 'BrtKnownFonts' */ break;
|
||||
case 0x002D: /* 'BrtFill' */
|
||||
case 0x0401: /* BrtKnownFonts */ break;
|
||||
case 0x002D: /* BrtFill */
|
||||
break;
|
||||
case 0x002E: /* 'BrtBorder' */
|
||||
case 0x002E: /* BrtBorder */
|
||||
break;
|
||||
case 0x002F: /* 'BrtXF' */
|
||||
if(state[state.length - 1] == "BrtBeginCellXFs") {
|
||||
case 0x002F: /* BrtXF */
|
||||
if(state[state.length - 1] == 0x0269 /* BrtBeginCellXFs */) {
|
||||
styles.CellXf.push(val);
|
||||
}
|
||||
break;
|
||||
case 0x0030: /* 'BrtStyle' */
|
||||
case 0x01FB: /* 'BrtDXF' */
|
||||
case 0x023C: /* 'BrtMRUColor' */
|
||||
case 0x01DB: /* 'BrtIndexedColor': */
|
||||
case 0x0030: /* BrtStyle */
|
||||
case 0x01FB: /* BrtDXF */
|
||||
case 0x023C: /* BrtMRUColor */
|
||||
case 0x01DB: /* BrtIndexedColor */
|
||||
break;
|
||||
|
||||
case 0x0493: /* 'BrtDXF14' */
|
||||
case 0x0836: /* 'BrtDXF15' */
|
||||
case 0x046A: /* 'BrtSlicerStyleElement' */
|
||||
case 0x0200: /* 'BrtTableStyleElement' */
|
||||
case 0x082F: /* 'BrtTimelineStyleElement' */
|
||||
case 0x0C00: /* 'BrtUid' */
|
||||
case 0x0493: /* BrtDXF14 */
|
||||
case 0x0836: /* BrtDXF15 */
|
||||
case 0x046A: /* BrtSlicerStyleElement */
|
||||
case 0x0200: /* BrtTableStyleElement */
|
||||
case 0x082F: /* BrtTimelineStyleElement */
|
||||
case 0x0C00: /* BrtUid */
|
||||
break;
|
||||
|
||||
case 0x0023: /* 'BrtFRTBegin' */
|
||||
case 0x0023: /* BrtFRTBegin */
|
||||
pass = true; break;
|
||||
case 0x0024: /* 'BrtFRTEnd' */
|
||||
case 0x0024: /* BrtFRTEnd */
|
||||
pass = false; break;
|
||||
case 0x0025: /* 'BrtACBegin' */
|
||||
state.push(R_n); pass = true; break;
|
||||
case 0x0026: /* 'BrtACEnd' */
|
||||
case 0x0025: /* BrtACBegin */
|
||||
state.push(RT); pass = true; break;
|
||||
case 0x0026: /* BrtACEnd */
|
||||
state.pop(); pass = false; break;
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0) state.push(R_n);
|
||||
else if((R_n||"").indexOf("End") > 0) state.pop();
|
||||
else if(!pass || (opts.WTF && state[state.length-1] != "BrtACBegin")) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T > 0) state.push(RT);
|
||||
else if(R.T < 0) state.pop();
|
||||
else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */)) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return styles;
|
||||
@ -273,20 +273,20 @@ function write_FMTS_bin(ba, NF/*:?SSFTable*/) {
|
||||
});
|
||||
|
||||
if(cnt == 0) return;
|
||||
write_record(ba, "BrtBeginFmts", write_UInt32LE(cnt));
|
||||
write_record(ba, 0x0267 /* BrtBeginFmts */, write_UInt32LE(cnt));
|
||||
[[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) {
|
||||
/*:: if(!NF) return; */
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, "BrtFmt", write_BrtFmt(i, NF[i]));
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, 0x002C /* BrtFmt */, write_BrtFmt(i, NF[i]));
|
||||
});
|
||||
write_record(ba, "BrtEndFmts");
|
||||
write_record(ba, 0x0268 /* BrtEndFmts */);
|
||||
}
|
||||
|
||||
function write_FONTS_bin(ba/*::, data*/) {
|
||||
var cnt = 1;
|
||||
|
||||
if(cnt == 0) return;
|
||||
write_record(ba, "BrtBeginFonts", write_UInt32LE(cnt));
|
||||
write_record(ba, "BrtFont", write_BrtFont({
|
||||
write_record(ba, 0x0263 /* BrtBeginFonts */, write_UInt32LE(cnt));
|
||||
write_record(ba, 0x002B /* BrtFont */, write_BrtFont({
|
||||
sz:12,
|
||||
color: {theme:1},
|
||||
name: "Calibri",
|
||||
@ -294,77 +294,77 @@ function write_FONTS_bin(ba/*::, data*/) {
|
||||
scheme: "minor"
|
||||
}));
|
||||
/* 1*65491BrtFont [ACFONTS] */
|
||||
write_record(ba, "BrtEndFonts");
|
||||
write_record(ba, 0x0264 /* BrtEndFonts */);
|
||||
}
|
||||
|
||||
function write_FILLS_bin(ba/*::, data*/) {
|
||||
var cnt = 2;
|
||||
|
||||
if(cnt == 0) return;
|
||||
write_record(ba, "BrtBeginFills", write_UInt32LE(cnt));
|
||||
write_record(ba, "BrtFill", write_BrtFill({patternType:"none"}));
|
||||
write_record(ba, "BrtFill", write_BrtFill({patternType:"gray125"}));
|
||||
write_record(ba, 0x025B /* BrtBeginFills */, write_UInt32LE(cnt));
|
||||
write_record(ba, 0x002D /* BrtFill */, write_BrtFill({patternType:"none"}));
|
||||
write_record(ba, 0x002D /* BrtFill */, write_BrtFill({patternType:"gray125"}));
|
||||
/* 1*65431BrtFill */
|
||||
write_record(ba, "BrtEndFills");
|
||||
write_record(ba, 0x025C /* BrtEndFills */);
|
||||
}
|
||||
|
||||
function write_BORDERS_bin(ba/*::, data*/) {
|
||||
var cnt = 1;
|
||||
|
||||
if(cnt == 0) return;
|
||||
write_record(ba, "BrtBeginBorders", write_UInt32LE(cnt));
|
||||
write_record(ba, "BrtBorder", write_BrtBorder({}));
|
||||
write_record(ba, 0x0265 /* BrtBeginBorders */, write_UInt32LE(cnt));
|
||||
write_record(ba, 0x002E /* BrtBorder */, write_BrtBorder({}));
|
||||
/* 1*65430BrtBorder */
|
||||
write_record(ba, "BrtEndBorders");
|
||||
write_record(ba, 0x0266 /* BrtEndBorders */);
|
||||
}
|
||||
|
||||
function write_CELLSTYLEXFS_bin(ba/*::, data*/) {
|
||||
var cnt = 1;
|
||||
write_record(ba, "BrtBeginCellStyleXFs", write_UInt32LE(cnt));
|
||||
write_record(ba, "BrtXF", write_BrtXF({
|
||||
write_record(ba, 0x0272 /* BrtBeginCellStyleXFs */, write_UInt32LE(cnt));
|
||||
write_record(ba, 0x002F /* BrtXF */, write_BrtXF({
|
||||
numFmtId: 0,
|
||||
fontId: 0,
|
||||
fillId: 0,
|
||||
borderId: 0
|
||||
}, 0xFFFF));
|
||||
/* 1*65430(BrtXF *FRT) */
|
||||
write_record(ba, "BrtEndCellStyleXFs");
|
||||
write_record(ba, 0x0273 /* BrtEndCellStyleXFs */);
|
||||
}
|
||||
|
||||
function write_CELLXFS_bin(ba, data) {
|
||||
write_record(ba, "BrtBeginCellXFs", write_UInt32LE(data.length));
|
||||
data.forEach(function(c) { write_record(ba, "BrtXF", write_BrtXF(c,0)); });
|
||||
write_record(ba, 0x0269 /* BrtBeginCellXFs */, write_UInt32LE(data.length));
|
||||
data.forEach(function(c) { write_record(ba, 0x002F /* BrtXF */, write_BrtXF(c,0)); });
|
||||
/* 1*65430(BrtXF *FRT) */
|
||||
write_record(ba, "BrtEndCellXFs");
|
||||
write_record(ba, 0x026A /* BrtEndCellXFs */);
|
||||
}
|
||||
|
||||
function write_STYLES_bin(ba/*::, data*/) {
|
||||
var cnt = 1;
|
||||
|
||||
write_record(ba, "BrtBeginStyles", write_UInt32LE(cnt));
|
||||
write_record(ba, "BrtStyle", write_BrtStyle({
|
||||
write_record(ba, 0x026B /* BrtBeginStyles */, write_UInt32LE(cnt));
|
||||
write_record(ba, 0x0030 /* BrtStyle */, write_BrtStyle({
|
||||
xfId:0,
|
||||
builtinId:0,
|
||||
name:"Normal"
|
||||
}));
|
||||
/* 1*65430(BrtStyle *FRT) */
|
||||
write_record(ba, "BrtEndStyles");
|
||||
write_record(ba, 0x026C /* BrtEndStyles */);
|
||||
}
|
||||
|
||||
function write_DXFS_bin(ba/*::, data*/) {
|
||||
var cnt = 0;
|
||||
|
||||
write_record(ba, "BrtBeginDXFs", write_UInt32LE(cnt));
|
||||
write_record(ba, 0x01F9 /* BrtBeginDXFs */, write_UInt32LE(cnt));
|
||||
/* *2147483647(BrtDXF *FRT) */
|
||||
write_record(ba, "BrtEndDXFs");
|
||||
write_record(ba, 0x01FA /* BrtEndDXFs */);
|
||||
}
|
||||
|
||||
function write_TABLESTYLES_bin(ba/*::, data*/) {
|
||||
var cnt = 0;
|
||||
|
||||
write_record(ba, "BrtBeginTableStyles", write_BrtBeginTableStyles(cnt, "TableStyleMedium9", "PivotStyleMedium4"));
|
||||
write_record(ba, 0x01FC /* BrtBeginTableStyles */, write_BrtBeginTableStyles(cnt, "TableStyleMedium9", "PivotStyleMedium4"));
|
||||
/* *TABLESTYLE */
|
||||
write_record(ba, "BrtEndTableStyles");
|
||||
write_record(ba, 0x01FD /* BrtEndTableStyles */);
|
||||
}
|
||||
|
||||
function write_COLORPALETTE_bin(/*::ba, data*/) {
|
||||
@ -375,7 +375,7 @@ function write_COLORPALETTE_bin(/*::ba, data*/) {
|
||||
/* [MS-XLSB] 2.1.7.50 Styles */
|
||||
function write_sty_bin(wb, opts) {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginStyleSheet");
|
||||
write_record(ba, 0x0116 /* BrtBeginStyleSheet */);
|
||||
write_FMTS_bin(ba, wb.SSF);
|
||||
write_FONTS_bin(ba, wb);
|
||||
write_FILLS_bin(ba, wb);
|
||||
@ -387,6 +387,6 @@ function write_sty_bin(wb, opts) {
|
||||
write_TABLESTYLES_bin(ba, wb);
|
||||
write_COLORPALETTE_bin(ba, wb);
|
||||
/* FRTSTYLESHEET*/
|
||||
write_record(ba, "BrtEndStyleSheet");
|
||||
write_record(ba, 0x0117 /* BrtEndStyleSheet */);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ var themeltregex = /<a:themeElements([^>]*)>[\s\S]*<\/a:themeElements>/;
|
||||
/* 14.2.7 Theme Part */
|
||||
function parse_theme_xml(data/*:string*/, opts) {
|
||||
/* 20.1.6.9 theme CT_OfficeStyleSheet */
|
||||
if(!data || data.length === 0) return parse_theme_xml(write_theme());
|
||||
if(!data || data.length === 0) data = write_theme();
|
||||
|
||||
var t;
|
||||
var themes = {};
|
||||
|
@ -101,7 +101,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
var opts = _opts || {};
|
||||
var state = [];
|
||||
var pass = false;
|
||||
recordhopper(data, function(val, R_n, RT) {
|
||||
recordhopper(data, function(val, R, RT) {
|
||||
switch (RT) {
|
||||
case 335:
|
||||
out.Types.push({ name: val.name });
|
||||
@ -109,7 +109,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
case 51:
|
||||
break;
|
||||
case 35:
|
||||
state.push(R_n);
|
||||
state.push(RT);
|
||||
pass = true;
|
||||
break;
|
||||
case 36:
|
||||
@ -117,35 +117,34 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
pass = false;
|
||||
break;
|
||||
default:
|
||||
if ((R_n || "").indexOf("Begin") > 0) {
|
||||
} else if ((R_n || "").indexOf("End") > 0) {
|
||||
} else if (!pass || opts.WTF && state[state.length - 1] != "BrtFRTBegin")
|
||||
throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if (R.T) {
|
||||
} else if (!pass || opts.WTF && state[state.length - 1] != 35)
|
||||
throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function write_xlmeta_bin() {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginMetadata");
|
||||
write_record(ba, "BrtBeginEsmdtinfo", write_UInt32LE(1));
|
||||
write_record(ba, "BrtMdtinfo", write_BrtMdtinfo({
|
||||
write_record(ba, 332);
|
||||
write_record(ba, 334, write_UInt32LE(1));
|
||||
write_record(ba, 335, write_BrtMdtinfo({
|
||||
name: "XLDAPR",
|
||||
version: 12e4,
|
||||
flags: 3496657072
|
||||
}));
|
||||
write_record(ba, "BrtEndEsmdtinfo");
|
||||
write_record(ba, "BrtBeginEsfmd", write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, "BrtBeginFmd");
|
||||
write_record(ba, "BrtFRTBegin", write_UInt32LE(514));
|
||||
write_record(ba, "BrtBeginDynamicArrayPr", write_UInt32LE(0));
|
||||
write_record(ba, "BrtEndDynamicArrayPr", writeuint16(1));
|
||||
write_record(ba, "BrtFRTEnd");
|
||||
write_record(ba, "BrtEndFmd");
|
||||
write_record(ba, "BrtEndEsfmd");
|
||||
write_record(ba, "BrtBeginEsmdb", write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, "BrtMdb", write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, "BrtEndEsmdb");
|
||||
write_record(ba, "BrtEndMetadata");
|
||||
write_record(ba, 336);
|
||||
write_record(ba, 339, write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, 52);
|
||||
write_record(ba, 35, write_UInt32LE(514));
|
||||
write_record(ba, 4096, write_UInt32LE(0));
|
||||
write_record(ba, 4097, writeuint16(1));
|
||||
write_record(ba, 36);
|
||||
write_record(ba, 53);
|
||||
write_record(ba, 340);
|
||||
write_record(ba, 337, write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, 51, write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, 338);
|
||||
write_record(ba, 333);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -36,15 +36,14 @@ function parse_BrtCalcChainItem$(data) {
|
||||
function parse_cc_bin(data, name, opts) {
|
||||
var out = [];
|
||||
var pass = false;
|
||||
recordhopper(data, function hopper_cc(val, R_n, RT) {
|
||||
recordhopper(data, function hopper_cc(val, R, RT) {
|
||||
switch(RT) {
|
||||
case 0x003F: /* 'BrtCalcChainItem$' */
|
||||
out.push(val); break;
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0){/* empty */}
|
||||
else if((R_n||"").indexOf("End") > 0){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
|
@ -11,7 +11,7 @@ function parse_xlink_bin(data, rel, name/*:string*/, _opts) {
|
||||
|
||||
var pass = false, end = false;
|
||||
|
||||
recordhopper(data, function xlink_parse(val, R_n, RT) {
|
||||
recordhopper(data, function xlink_parse(val, R, RT) {
|
||||
if(end) return;
|
||||
switch(RT) {
|
||||
case 0x0167: /* 'BrtSupTabs' */
|
||||
@ -43,9 +43,8 @@ function parse_xlink_bin(data, rel, name/*:string*/, _opts) {
|
||||
pass = false; break;
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0){/* empty */}
|
||||
else if((R_n||"").indexOf("End") > 0){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT.toString(16) + " " + R_n);
|
||||
if(R.T){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
}, opts);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ function parse_comments_xml(data/*:string*/, opts)/*:Array<RawComment>*/ {
|
||||
}
|
||||
|
||||
function write_comments_xml(data/*::, opts*/) {
|
||||
var o = [XML_HEADER, writextag('comments', null, { 'xmlns': XMLNS.main[0] })];
|
||||
var o = [XML_HEADER, writextag('comments', null, { 'xmlns': XMLNS_main[0] })];
|
||||
|
||||
var iauthor/*:Array<string>*/ = [];
|
||||
o.push("<authors>");
|
||||
|
@ -29,7 +29,7 @@ function parse_comments_bin(data, opts)/*:Array<RawComment>*/ {
|
||||
var authors/*:Array<string>*/ = [];
|
||||
var c = {};
|
||||
var pass = false;
|
||||
recordhopper(data, function hopper_cmnt(val, R_n, RT) {
|
||||
recordhopper(data, function hopper_cmnt(val, R, RT) {
|
||||
switch(RT) {
|
||||
case 0x0278: /* 'BrtCommentAuthor' */
|
||||
authors.push(val); break;
|
||||
@ -56,9 +56,8 @@ function parse_comments_bin(data, opts)/*:Array<RawComment>*/ {
|
||||
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0){/* empty */}
|
||||
else if((R_n||"").indexOf("End") > 0){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
@ -67,31 +66,31 @@ function parse_comments_bin(data, opts)/*:Array<RawComment>*/ {
|
||||
function write_comments_bin(data/*::, opts*/) {
|
||||
var ba = buf_array();
|
||||
var iauthor/*:Array<string>*/ = [];
|
||||
write_record(ba, "BrtBeginComments");
|
||||
write_record(ba, 0x0274 /* BrtBeginComments */);
|
||||
|
||||
write_record(ba, "BrtBeginCommentAuthors");
|
||||
write_record(ba, 0x0276 /* BrtBeginCommentAuthors */);
|
||||
data.forEach(function(comment) {
|
||||
comment[1].forEach(function(c) {
|
||||
if(iauthor.indexOf(c.a) > -1) return;
|
||||
iauthor.push(c.a.slice(0,54));
|
||||
write_record(ba, "BrtCommentAuthor", write_BrtCommentAuthor(c.a));
|
||||
write_record(ba, 0x0278 /* BrtCommentAuthor */, write_BrtCommentAuthor(c.a));
|
||||
});
|
||||
});
|
||||
write_record(ba, "BrtEndCommentAuthors");
|
||||
write_record(ba, 0x0277 /* BrtEndCommentAuthors */);
|
||||
|
||||
write_record(ba, "BrtBeginCommentList");
|
||||
write_record(ba, 0x0279 /* BrtBeginCommentList */);
|
||||
data.forEach(function(comment) {
|
||||
comment[1].forEach(function(c) {
|
||||
c.iauthor = iauthor.indexOf(c.a);
|
||||
var range = {s:decode_cell(comment[0]),e:decode_cell(comment[0])};
|
||||
write_record(ba, "BrtBeginComment", write_BrtBeginComment([range, c]));
|
||||
if(c.t && c.t.length > 0) write_record(ba, "BrtCommentText", write_BrtCommentText(c));
|
||||
write_record(ba, "BrtEndComment");
|
||||
write_record(ba, 0x027B /* BrtBeginComment */, write_BrtBeginComment([range, c]));
|
||||
if(c.t && c.t.length > 0) write_record(ba, 0x027D /* BrtCommentText */, write_BrtCommentText(c));
|
||||
write_record(ba, 0x027C /* BrtEndComment */);
|
||||
delete c.iauthor;
|
||||
});
|
||||
});
|
||||
write_record(ba, "BrtEndCommentList");
|
||||
write_record(ba, 0x027A /* BrtEndCommentList */);
|
||||
|
||||
write_record(ba, "BrtEndComments");
|
||||
write_record(ba, 0x0275 /* BrtEndComments */);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* TODO: it will be useful to parse the function str */
|
||||
var rc_to_a1 = (function(){
|
||||
var rc_to_a1 = /*#__PURE__*/(function(){
|
||||
var rcregex = /(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g;
|
||||
var rcbase/*:Cell*/ = ({r:0,c:0}/*:any*/);
|
||||
function rcfunc($$,$1,$2,$3) {
|
||||
@ -24,7 +24,7 @@ var rc_to_a1 = (function(){
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
var a1_to_rc = /*#__PURE__*/(function(){
|
||||
return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
var c = decode_col($3) - ($2 ? 0 : base.c);
|
||||
|
@ -572,7 +572,6 @@ var PtgDupes = {
|
||||
/*::[*/0x5C/*::]*/: 0x3C, /*::[*/0x7C/*::]*/: 0x3C,
|
||||
/*::[*/0x5D/*::]*/: 0x3D, /*::[*/0x7D/*::]*/: 0x3D
|
||||
};
|
||||
(function(){for(var y in PtgDupes) PtgTypes[y] = PtgTypes[PtgDupes[y]];})();
|
||||
|
||||
var Ptg18 = {
|
||||
/*::[*/0x01/*::]*/: { n:'PtgElfLel', f:parse_PtgElfLel },
|
||||
@ -646,7 +645,7 @@ function parse_Rgce(blob, length, opts) {
|
||||
while(target != blob.l) {
|
||||
length = target - blob.l;
|
||||
id = blob[blob.l];
|
||||
R = PtgTypes[id];
|
||||
R = PtgTypes[id] || PtgTypes[PtgDupes[id]];
|
||||
if(id === 0x18 || id === 0x19) R = (id === 0x18 ? Ptg18 : Ptg19)[blob[blob.l + 1]];
|
||||
if(!R || !R.f) { /*ptgs.push*/(parsenoop(blob, length)); }
|
||||
else { ptgs.push([R.n, R.f(blob, length, opts)]); }
|
||||
|
@ -304,7 +304,7 @@ function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string
|
||||
return writextag('c', v, o);
|
||||
}
|
||||
|
||||
var parse_ws_xml_data = (function() {
|
||||
var parse_ws_xml_data = /*#__PURE__*/(function() {
|
||||
var cellregex = /<(?:\w+:)?c[ \/>]/, rowregex = /<\/(?:\w+:)?row>/;
|
||||
var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/;
|
||||
var refregex = /ref=["']([^"']*)["']/;
|
||||
@ -537,7 +537,7 @@ function write_ws_xml_data(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook
|
||||
|
||||
function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
var o = [XML_HEADER, writextag('worksheet', null, {
|
||||
'xmlns': XMLNS.main[0],
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
})];
|
||||
var s = wb.SheetNames[idx], sidx = 0, rdata = "";
|
||||
|
@ -64,7 +64,7 @@ function write_BrtRowHdr(R/*:number*/, range, ws) {
|
||||
}
|
||||
function write_row_header(ba, ws, range, R) {
|
||||
var o = write_BrtRowHdr(R, range, ws);
|
||||
if((o.length > 17) || (ws['!rows']||[])[R]) write_record(ba, 'BrtRowHdr', o);
|
||||
if((o.length > 17) || (ws['!rows']||[])[R]) write_record(ba, 0x0000 /* BrtRowHdr */, o);
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.4.820 BrtWsDim */
|
||||
@ -540,7 +540,7 @@ function parse_ws_bin(data, _opts, idx, rels, wb/*:WBWBProps*/, themes, styles)/
|
||||
|
||||
var cm, vm;
|
||||
|
||||
recordhopper(data, function ws_parse(val, R_n, RT) {
|
||||
recordhopper(data, function ws_parse(val, R, RT) {
|
||||
if(end) return;
|
||||
switch(RT) {
|
||||
case 0x0094: /* 'BrtWsDim' */
|
||||
@ -769,14 +769,13 @@ function parse_ws_bin(data, _opts, idx, rels, wb/*:WBWBProps*/, themes, styles)/
|
||||
case 0x0024: /* 'BrtFRTEnd' */
|
||||
pass = false; break;
|
||||
case 0x0025: /* 'BrtACBegin' */
|
||||
state.push(R_n); pass = true; break;
|
||||
state.push(RT); pass = true; break;
|
||||
case 0x0026: /* 'BrtACEnd' */
|
||||
state.pop(); pass = false; break;
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0){/* empty */}
|
||||
else if((R_n||"").indexOf("End") > 0){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T){/* empty */}
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
}, opts);
|
||||
|
||||
@ -827,42 +826,42 @@ function write_ws_bin_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:num
|
||||
if(opts.bookSST) {
|
||||
vv = get_sst_id(opts.Strings, (cell.v/*:any*/), opts.revStrings);
|
||||
o.t = "s"; o.v = vv;
|
||||
if(last_seen) write_record(ba, "BrtShortIsst", write_BrtShortIsst(cell, o));
|
||||
else write_record(ba, "BrtCellIsst", write_BrtCellIsst(cell, o));
|
||||
if(last_seen) write_record(ba, 0x0012 /* BrtShortIsst */, write_BrtShortIsst(cell, o));
|
||||
else write_record(ba, 0x0007 /* BrtCellIsst */, write_BrtCellIsst(cell, o));
|
||||
} else {
|
||||
o.t = "str";
|
||||
if(last_seen) write_record(ba, "BrtShortSt", write_BrtShortSt(cell, o));
|
||||
else write_record(ba, "BrtCellSt", write_BrtCellSt(cell, o));
|
||||
if(last_seen) write_record(ba, 0x0011 /* BrtShortSt */, write_BrtShortSt(cell, o));
|
||||
else write_record(ba, 0x0006 /* BrtCellSt */, write_BrtCellSt(cell, o));
|
||||
}
|
||||
return true;
|
||||
case 'n':
|
||||
/* TODO: determine threshold for Real vs RK */
|
||||
if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) {
|
||||
if(last_seen) write_record(ba, "BrtShortRk", write_BrtShortRk(cell, o));
|
||||
else write_record(ba, "BrtCellRk", write_BrtCellRk(cell, o));
|
||||
if(last_seen) write_record(ba, 0x000D /* BrtShortRk */, write_BrtShortRk(cell, o));
|
||||
else write_record(ba, 0x0002 /* BrtCellRk */, write_BrtCellRk(cell, o));
|
||||
} else {
|
||||
if(last_seen) write_record(ba, "BrtShortReal", write_BrtShortReal(cell, o));
|
||||
else write_record(ba, "BrtCellReal", write_BrtCellReal(cell, o));
|
||||
if(last_seen) write_record(ba, 0x0010 /* BrtShortReal */, write_BrtShortReal(cell, o));
|
||||
else write_record(ba, 0x0005 /* BrtCellReal */, write_BrtCellReal(cell, o));
|
||||
} return true;
|
||||
case 'b':
|
||||
o.t = "b";
|
||||
if(last_seen) write_record(ba, "BrtShortBool", write_BrtShortBool(cell, o));
|
||||
else write_record(ba, "BrtCellBool", write_BrtCellBool(cell, o));
|
||||
if(last_seen) write_record(ba, 0x000F /* BrtShortBool */, write_BrtShortBool(cell, o));
|
||||
else write_record(ba, 0x0004 /* BrtCellBool */, write_BrtCellBool(cell, o));
|
||||
return true;
|
||||
case 'e':
|
||||
o.t = "e";
|
||||
if(last_seen) write_record(ba, "BrtShortError", write_BrtShortError(cell, o));
|
||||
else write_record(ba, "BrtCellError", write_BrtCellError(cell, o));
|
||||
if(last_seen) write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError(cell, o));
|
||||
else write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError(cell, o));
|
||||
return true;
|
||||
}
|
||||
if(last_seen) write_record(ba, "BrtShortBlank", write_BrtShortBlank(cell, o));
|
||||
else write_record(ba, "BrtCellBlank", write_BrtCellBlank(cell, o));
|
||||
if(last_seen) write_record(ba, 0x000C /* BrtShortBlank */, write_BrtShortBlank(cell, o));
|
||||
else write_record(ba, 0x0001 /* BrtCellBlank */, write_BrtCellBlank(cell, o));
|
||||
return true;
|
||||
}
|
||||
|
||||
function write_CELLTABLE(ba, ws/*:Worksheet*/, idx/*:number*/, opts/*::, wb:Workbook*/) {
|
||||
var range = safe_decode_range(ws['!ref'] || "A1"), ref, rr = "", cols/*:Array<string>*/ = [];
|
||||
write_record(ba, 'BrtBeginSheetData');
|
||||
write_record(ba, 0x0091 /* BrtBeginSheetData */);
|
||||
var dense = Array.isArray(ws);
|
||||
var cap = range.e.r;
|
||||
if(ws['!rows']) cap = Math.max(range.e.r, ws['!rows'].length - 1);
|
||||
@ -882,28 +881,28 @@ function write_CELLTABLE(ba, ws/*:Worksheet*/, idx/*:number*/, opts/*::, wb:Work
|
||||
last_seen = write_ws_bin_cell(ba, cell, R, C, opts, ws, last_seen);
|
||||
}
|
||||
}
|
||||
write_record(ba, 'BrtEndSheetData');
|
||||
write_record(ba, 0x0092 /* BrtEndSheetData */);
|
||||
}
|
||||
|
||||
function write_MERGECELLS(ba, ws/*:Worksheet*/) {
|
||||
if(!ws || !ws['!merges']) return;
|
||||
write_record(ba, 'BrtBeginMergeCells', write_BrtBeginMergeCells(ws['!merges'].length));
|
||||
ws['!merges'].forEach(function(m) { write_record(ba, 'BrtMergeCell', write_BrtMergeCell(m)); });
|
||||
write_record(ba, 'BrtEndMergeCells');
|
||||
write_record(ba, 0x00B1 /* BrtBeginMergeCells */, write_BrtBeginMergeCells(ws['!merges'].length));
|
||||
ws['!merges'].forEach(function(m) { write_record(ba, 0x00B0 /* BrtMergeCell */, write_BrtMergeCell(m)); });
|
||||
write_record(ba, 0x00B2 /* BrtEndMergeCells */);
|
||||
}
|
||||
|
||||
function write_COLINFOS(ba, ws/*:Worksheet*//*::, idx:number, opts, wb:Workbook*/) {
|
||||
if(!ws || !ws['!cols']) return;
|
||||
write_record(ba, 'BrtBeginColInfos');
|
||||
ws['!cols'].forEach(function(m, i) { if(m) write_record(ba, 'BrtColInfo', write_BrtColInfo(i, m)); });
|
||||
write_record(ba, 'BrtEndColInfos');
|
||||
write_record(ba, 0x0186 /* BrtBeginColInfos */);
|
||||
ws['!cols'].forEach(function(m, i) { if(m) write_record(ba, 0x003C /* 'BrtColInfo' */, write_BrtColInfo(i, m)); });
|
||||
write_record(ba, 0x0187 /* BrtEndColInfos */);
|
||||
}
|
||||
|
||||
function write_IGNOREECS(ba, ws/*:Worksheet*/) {
|
||||
if(!ws || !ws['!ref']) return;
|
||||
write_record(ba, 'BrtBeginCellIgnoreECs');
|
||||
write_record(ba, 'BrtCellIgnoreEC', write_BrtCellIgnoreEC(safe_decode_range(ws['!ref'])));
|
||||
write_record(ba, 'BrtEndCellIgnoreECs');
|
||||
write_record(ba, 0x0288 /* BrtBeginCellIgnoreECs */);
|
||||
write_record(ba, 0x0289 /* BrtCellIgnoreEC */, write_BrtCellIgnoreEC(safe_decode_range(ws['!ref'])));
|
||||
write_record(ba, 0x028A /* BrtEndCellIgnoreECs */);
|
||||
}
|
||||
|
||||
function write_HLINKS(ba, ws/*:Worksheet*/, rels) {
|
||||
@ -911,7 +910,7 @@ function write_HLINKS(ba, ws/*:Worksheet*/, rels) {
|
||||
ws['!links'].forEach(function(l) {
|
||||
if(!l[1].Target) return;
|
||||
var rId = add_rels(rels, -1, l[1].Target.replace(/#.*$/, ""), RELS.HLINK);
|
||||
write_record(ba, "BrtHLink", write_BrtHLink(l, rId));
|
||||
write_record(ba, 0x01EE /* BrtHLink */, write_BrtHLink(l, rId));
|
||||
});
|
||||
delete ws['!links'];
|
||||
}
|
||||
@ -919,7 +918,7 @@ function write_LEGACYDRAWING(ba, ws/*:Worksheet*/, idx/*:number*/, rels) {
|
||||
/* [BrtLegacyDrawing] */
|
||||
if(ws['!comments'].length > 0) {
|
||||
var rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML);
|
||||
write_record(ba, "BrtLegacyDrawing", write_RelID("rId" + rId));
|
||||
write_record(ba, 0x0227 /* BrtLegacyDrawing */, write_RelID("rId" + rId));
|
||||
ws['!legacy'] = rId;
|
||||
}
|
||||
}
|
||||
@ -943,37 +942,37 @@ function write_AUTOFILTER(ba, ws, wb, idx) {
|
||||
}
|
||||
if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetNames[idx] + "'!" + ref });
|
||||
|
||||
write_record(ba, "BrtBeginAFilter", write_UncheckedRfX(safe_decode_range(ref)));
|
||||
write_record(ba, 0x00A1 /* BrtBeginAFilter */, write_UncheckedRfX(safe_decode_range(ref)));
|
||||
/* *FILTERCOLUMN */
|
||||
/* [SORTSTATE] */
|
||||
/* BrtEndAFilter */
|
||||
write_record(ba, "BrtEndAFilter");
|
||||
write_record(ba, 0x00A2 /* BrtEndAFilter */);
|
||||
}
|
||||
|
||||
function write_WSVIEWS2(ba, ws, Workbook) {
|
||||
write_record(ba, "BrtBeginWsViews");
|
||||
write_record(ba, 0x0085 /* BrtBeginWsViews */);
|
||||
{ /* 1*WSVIEW2 */
|
||||
/* [ACUID] */
|
||||
write_record(ba, "BrtBeginWsView", write_BrtBeginWsView(ws, Workbook));
|
||||
write_record(ba, 0x0089 /* BrtBeginWsView */, write_BrtBeginWsView(ws, Workbook));
|
||||
/* [BrtPane] */
|
||||
/* *4BrtSel */
|
||||
/* *4SXSELECT */
|
||||
/* *FRT */
|
||||
write_record(ba, "BrtEndWsView");
|
||||
write_record(ba, 0x008A /* BrtEndWsView */);
|
||||
}
|
||||
/* *FRT */
|
||||
write_record(ba, "BrtEndWsViews");
|
||||
write_record(ba, 0x0086 /* BrtEndWsViews */);
|
||||
}
|
||||
|
||||
function write_WSFMTINFO(/*::ba, ws*/) {
|
||||
/* [ACWSFMTINFO] */
|
||||
//write_record(ba, "BrtWsFmtInfo", write_BrtWsFmtInfo(ws));
|
||||
// write_record(ba, 0x01E5 /* BrtWsFmtInfo */, write_BrtWsFmtInfo(ws));
|
||||
}
|
||||
|
||||
function write_SHEETPROTECT(ba, ws) {
|
||||
if(!ws['!protect']) return;
|
||||
/* [BrtSheetProtectionIso] */
|
||||
write_record(ba, "BrtSheetProtection", write_BrtSheetProtection(ws['!protect']));
|
||||
write_record(ba, 0x0217 /* BrtSheetProtection */, write_BrtSheetProtection(ws['!protect']));
|
||||
}
|
||||
|
||||
function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
|
||||
@ -989,9 +988,9 @@ function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
|
||||
ws['!links'] = [];
|
||||
/* passed back to write_zip and removed there */
|
||||
ws['!comments'] = [];
|
||||
write_record(ba, "BrtBeginSheet");
|
||||
if(wb.vbaraw || ws['!outline']) write_record(ba, "BrtWsProp", write_BrtWsProp(c, ws['!outline']));
|
||||
write_record(ba, "BrtWsDim", write_BrtWsDim(r));
|
||||
write_record(ba, 0x0081 /* BrtBeginSheet */);
|
||||
if(wb.vbaraw || ws['!outline']) write_record(ba, 0x0093 /* BrtWsProp */, write_BrtWsProp(c, ws['!outline']));
|
||||
write_record(ba, 0x0094 /* BrtWsDim */, write_BrtWsDim(r));
|
||||
write_WSVIEWS2(ba, ws, wb.Workbook);
|
||||
write_WSFMTINFO(ba, ws);
|
||||
write_COLINFOS(ba, ws, idx, opts, wb);
|
||||
@ -1010,7 +1009,7 @@ function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
|
||||
/* [DVALS] */
|
||||
write_HLINKS(ba, ws, rels);
|
||||
/* [BrtPrintOptions] */
|
||||
if(ws['!margins']) write_record(ba, "BrtMargins", write_BrtMargins(ws['!margins']));
|
||||
if(ws['!margins']) write_record(ba, 0x01DC /* BrtMargins */, write_BrtMargins(ws['!margins']));
|
||||
/* [BrtPageSetup] */
|
||||
/* [HEADERFOOTER] */
|
||||
/* [RWBRK] */
|
||||
@ -1028,6 +1027,6 @@ function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
|
||||
/* [WEBPUBITEMS] */
|
||||
/* [LISTPARTS] */
|
||||
/* FRTWORKSHEET */
|
||||
write_record(ba, "BrtEndSheet");
|
||||
write_record(ba, 0x0082 /* BrtEndSheet */);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, them
|
||||
}
|
||||
function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
'xmlns': XMLNS.main[0],
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
})];
|
||||
o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
@ -43,7 +43,7 @@ function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/
|
||||
var s = {'!type':"chart", '!drawel':null, '!rel':""};
|
||||
var state/*:Array<string>*/ = [];
|
||||
var pass = false;
|
||||
recordhopper(data, function cs_parse(val, R_n, RT) {
|
||||
recordhopper(data, function cs_parse(val, R, RT) {
|
||||
switch(RT) {
|
||||
|
||||
case 0x0226: /* 'BrtDrawing' */
|
||||
@ -69,14 +69,14 @@ function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/
|
||||
case 0x0024: /* 'BrtFRTEnd' */
|
||||
pass = false; break;
|
||||
case 0x0025: /* 'BrtACBegin' */
|
||||
state.push(R_n); break;
|
||||
state.push(RT); break;
|
||||
case 0x0026: /* 'BrtACEnd' */
|
||||
state.pop(); break;
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0) state.push(R_n);
|
||||
else if((R_n||"").indexOf("End") > 0) state.pop();
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T > 0) state.push(RT);
|
||||
else if(R.T < 0) state.pop();
|
||||
else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
}, opts);
|
||||
|
||||
@ -85,7 +85,7 @@ function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/
|
||||
}
|
||||
function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginSheet");
|
||||
write_record(ba, 0x0081 /* BrtBeginSheet */);
|
||||
/* [BrtCsProp] */
|
||||
/* CSVIEWS */
|
||||
/* [[BrtCsProtectionIso] BrtCsProtection] */
|
||||
@ -99,6 +99,6 @@ function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) {
|
||||
/* [BrtBkHim] */
|
||||
/* [WEBPUBITEMS] */
|
||||
/* FRTCHARTSHEET */
|
||||
write_record(ba, "BrtEndSheet");
|
||||
write_record(ba, 0x0082 /* BrtEndSheet */);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ function parse_wb_xml(data, opts)/*:WorkbookFile*/ {
|
||||
}
|
||||
return x;
|
||||
});
|
||||
if(XMLNS.main.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns);
|
||||
if(XMLNS_main.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns);
|
||||
|
||||
parse_wb_defaults(wb);
|
||||
|
||||
@ -161,9 +161,9 @@ function parse_wb_xml(data, opts)/*:WorkbookFile*/ {
|
||||
function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
|
||||
var o = [XML_HEADER];
|
||||
o[o.length] = writextag('workbook', null, {
|
||||
'xmlns': XMLNS.main[0],
|
||||
'xmlns': XMLNS_main[0],
|
||||
//'xmlns:mx': XMLNS.mx,
|
||||
//'xmlns:s': XMLNS.main[0],
|
||||
//'xmlns:s': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
});
|
||||
|
||||
|
@ -99,7 +99,7 @@ function parse_wb_bin(data, opts)/*:WorkbookFile*/ {
|
||||
|
||||
XLSBRecordEnum[0x0010] = { n:"BrtFRTArchID$", f:parse_BrtFRTArchID$ };
|
||||
|
||||
recordhopper(data, function hopper_wb(val, R_n, RT) {
|
||||
recordhopper(data, function hopper_wb(val, R, RT) {
|
||||
switch(RT) {
|
||||
case 0x009C: /* 'BrtBundleSh' */
|
||||
supbooks.SheetNames.push(val.name);
|
||||
@ -169,20 +169,19 @@ function parse_wb_bin(data, opts)/*:WorkbookFile*/ {
|
||||
break;
|
||||
|
||||
case 0x0023: /* 'BrtFRTBegin' */
|
||||
state.push(R_n); pass = true; break;
|
||||
state.push(RT); pass = true; break;
|
||||
case 0x0024: /* 'BrtFRTEnd' */
|
||||
state.pop(); pass = false; break;
|
||||
case 0x0025: /* 'BrtACBegin' */
|
||||
state.push(R_n); pass = true; break;
|
||||
state.push(RT); pass = true; break;
|
||||
case 0x0026: /* 'BrtACEnd' */
|
||||
state.pop(); pass = false; break;
|
||||
|
||||
case 0x0010: /* 'BrtFRTArchID$' */ break;
|
||||
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0){/* empty */}
|
||||
else if((R_n||"").indexOf("End") > 0){/* empty */}
|
||||
else if(!pass || (opts.WTF && state[state.length-1] != "BrtACBegin" && state[state.length-1] != "BrtFRTBegin")) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T){/* empty */}
|
||||
else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */ && state[state.length-1] != 0x0023 /* BrtFRTBegin */)) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
}, opts);
|
||||
|
||||
@ -196,13 +195,13 @@ function parse_wb_bin(data, opts)/*:WorkbookFile*/ {
|
||||
}
|
||||
|
||||
function write_BUNDLESHS(ba, wb/*::, opts*/) {
|
||||
write_record(ba, "BrtBeginBundleShs");
|
||||
write_record(ba, 0x008F /* BrtBeginBundleShs */);
|
||||
for(var idx = 0; idx != wb.SheetNames.length; ++idx) {
|
||||
var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].Hidden || 0;
|
||||
var d = { Hidden: viz, iTabID: idx+1, strRelID: 'rId' + (idx+1), name: wb.SheetNames[idx] };
|
||||
write_record(ba, "BrtBundleSh", write_BrtBundleSh(d));
|
||||
write_record(ba, 0x009C /* BrtBundleSh */, write_BrtBundleSh(d));
|
||||
}
|
||||
write_record(ba, "BrtEndBundleShs");
|
||||
write_record(ba, 0x0090 /* BrtEndBundleShs */);
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.4.649 BrtFileVersion */
|
||||
@ -241,10 +240,10 @@ function write_BOOKVIEWS(ba, wb/*::, opts*/) {
|
||||
else if(sheets[i].Hidden == 1 && hidden == -1) hidden = i;
|
||||
}
|
||||
if(hidden > vistab) return;
|
||||
write_record(ba, "BrtBeginBookViews");
|
||||
write_record(ba, "BrtBookView", write_BrtBookView(vistab));
|
||||
write_record(ba, 0x0087 /* BrtBeginBookViews */);
|
||||
write_record(ba, 0x009E /* BrtBookView */, write_BrtBookView(vistab));
|
||||
/* 1*(BrtBookView *FRT) */
|
||||
write_record(ba, "BrtEndBookViews");
|
||||
write_record(ba, 0x0088 /* BrtEndBookViews */);
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.4.305 BrtCalcProp */
|
||||
@ -270,10 +269,10 @@ function write_BOOKVIEWS(ba, wb/*::, opts*/) {
|
||||
/* [MS-XLSB] 2.1.7.61 Workbook */
|
||||
function write_wb_bin(wb, opts) {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginBook");
|
||||
write_record(ba, "BrtFileVersion", write_BrtFileVersion());
|
||||
write_record(ba, 0x0083 /* BrtBeginBook */);
|
||||
write_record(ba, 0x0080 /* BrtFileVersion */, write_BrtFileVersion());
|
||||
/* [[BrtFileSharingIso] BrtFileSharing] */
|
||||
write_record(ba, "BrtWbProp", write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null));
|
||||
write_record(ba, 0x0099 /* BrtWbProp */, write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null));
|
||||
/* [ACABSPATH] */
|
||||
/* [[BrtBookProtectionIso] BrtBookProtection] */
|
||||
write_BOOKVIEWS(ba, wb, opts);
|
||||
@ -281,18 +280,18 @@ function write_wb_bin(wb, opts) {
|
||||
/* [FNGROUP] */
|
||||
/* [EXTERNALS] */
|
||||
/* *BrtName */
|
||||
/* write_record(ba, "BrtCalcProp", write_BrtCalcProp()); */
|
||||
/* write_record(ba, 0x009D BrtCalcProp, write_BrtCalcProp()); */
|
||||
/* [BrtOleSize] */
|
||||
/* *(BrtUserBookView *FRT) */
|
||||
/* [PIVOTCACHEIDS] */
|
||||
/* [BrtWbFactoid] */
|
||||
/* [SMARTTAGTYPES] */
|
||||
/* [BrtWebOpt] */
|
||||
/* write_record(ba, "BrtFileRecover", write_BrtFileRecover()); */
|
||||
/* write_record(ba, 0x009B BrtFileRecover, write_BrtFileRecover()); */
|
||||
/* [WEBPUBITEMS] */
|
||||
/* [CRERRS] */
|
||||
/* FRTWORKBOOK */
|
||||
write_record(ba, "BrtEndBook");
|
||||
write_record(ba, 0x0084 /* BrtEndBook */);
|
||||
|
||||
return ba.end();
|
||||
}
|
||||
|
539
bits/76_xls.js
539
bits/76_xls.js
@ -28,45 +28,46 @@ function parse_compobj(obj/*:CFBEntry*/) {
|
||||
|
||||
/*
|
||||
Continue logic for:
|
||||
- 2.4.58 Continue
|
||||
- 2.4.59 ContinueBigName
|
||||
- 2.4.60 ContinueFrt
|
||||
- 2.4.61 ContinueFrt11
|
||||
- 2.4.62 ContinueFrt12
|
||||
- 2.4.58 Continue 0x003c
|
||||
- 2.4.59 ContinueBigName 0x043c
|
||||
- 2.4.60 ContinueFrt 0x0812
|
||||
- 2.4.61 ContinueFrt11 0x0875
|
||||
- 2.4.62 ContinueFrt12 0x087f
|
||||
*/
|
||||
function slurp(R, blob, length/*:number*/, opts)/*:any*/ {
|
||||
var CONTINUE_RT = [ 0x003c, 0x043c, 0x0812, 0x0875, 0x087f ];
|
||||
function slurp(RecordType, R, blob, length/*:number*/, opts)/*:any*/ {
|
||||
var l = length;
|
||||
var bufs = [];
|
||||
var d = blob.slice(blob.l,blob.l+l);
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(R.n) {
|
||||
case 'BOF': case 'FilePass': case 'FileLock': case 'InterfaceHdr': case 'RRDInfo': case 'RRDHead': case 'UsrExcl': case 'EOF':
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002f /* FilePass */: case 0x0195 /* FileLock */: case 0x00e1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
break;
|
||||
case 'BoundSheet8':
|
||||
case 0x0085 /* BoundSheet8 */:
|
||||
break;
|
||||
default:
|
||||
opts.enc.insitu(d);
|
||||
}
|
||||
bufs.push(d);
|
||||
blob.l += l;
|
||||
var next = (XLSRecordEnum[__readUInt16LE(blob,blob.l)]);
|
||||
var nextrt = __readUInt16LE(blob,blob.l), next = XLSRecordEnum[nextrt];
|
||||
var start = 0;
|
||||
while(next != null && next.n.slice(0,8) === 'Continue') {
|
||||
while(next != null && CONTINUE_RT.indexOf(nextrt) > -1) {
|
||||
l = __readUInt16LE(blob,blob.l+2);
|
||||
start = blob.l + 4;
|
||||
if(next.n == 'ContinueFrt') start += 4;
|
||||
else if(next.n.slice(0,11) == 'ContinueFrt') {
|
||||
if(nextrt == 0x0812 /* ContinueFrt */) start += 4;
|
||||
else if(nextrt == 0x0875 || nextrt == 0x087f) {
|
||||
start += 12;
|
||||
}
|
||||
d = blob.slice(start,blob.l+4+l);
|
||||
bufs.push(d);
|
||||
blob.l += 4+l;
|
||||
next = (XLSRecordEnum[__readUInt16LE(blob, blob.l)]);
|
||||
next = (XLSRecordEnum[nextrt = __readUInt16LE(blob, blob.l)]);
|
||||
}
|
||||
var b = (bconcat(bufs)/*:any*/);
|
||||
prep_blob(b, 0);
|
||||
var ll = 0; b.lens = [];
|
||||
for(var j = 0; j < bufs.length; ++j) { b.lens.push(ll); ll += bufs[j].length; }
|
||||
if(b.length < length) throw "XLS Record " + (R && R.n || "??") + " Truncated: " + b.length + " < " + length;
|
||||
if(b.length < length) throw "XLS Record 0x" + RecordType.toString(16) + " Truncated: " + b.length + " < " + length;
|
||||
return R.f(b, b.length, opts);
|
||||
}
|
||||
|
||||
@ -189,7 +190,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
supbooks.arrayf = opts.arrayf;
|
||||
supbooks.names = [];
|
||||
supbooks.XTI = [];
|
||||
var last_Rn = '';
|
||||
var last_RT = 0;
|
||||
var file_depth = 0; /* TODO: make a real stack */
|
||||
var BIFF2Fmt = 0, BIFF2FmtTable/*:Array<string>*/ = [];
|
||||
var FilterDatabases = []; /* TODO: sort out supbooks and process elsewhere */
|
||||
@ -202,16 +203,16 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
while(blob.l < blob.length - 1) {
|
||||
var s = blob.l;
|
||||
var RecordType = blob.read_shift(2);
|
||||
if(RecordType === 0 && last_Rn === 'EOF') break;
|
||||
if(RecordType === 0 && last_RT === 0x000a /* EOF */) break;
|
||||
var length = (blob.l === blob.length ? 0 : blob.read_shift(2));
|
||||
var R = XLSRecordEnum[RecordType];
|
||||
//console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length);
|
||||
//if(!R) console.log(blob.slice(blob.l, blob.l + length));
|
||||
if(R && R.f) {
|
||||
if(options.bookSheets) {
|
||||
if(last_Rn === 'BoundSheet8' && R.n !== 'BoundSheet8') break;
|
||||
if(last_RT === 0x0085 /* BoundSheet8 */ && RecordType !== 0x0085 /* R.n !== 'BoundSheet8' */) break;
|
||||
}
|
||||
last_Rn = R.n;
|
||||
last_RT = RecordType;
|
||||
if(R.r === 2 || R.r == 12) {
|
||||
var rt = blob.read_shift(2); length -= 2;
|
||||
if(!opts.enc && rt !== RecordType && (((rt&0xFF)<<8)|(rt>>8)) !== RecordType) throw new Error("rt mismatch: " + rt + "!=" + RecordType);
|
||||
@ -221,28 +222,26 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
}
|
||||
//console.error(R,blob.l,length,blob.length);
|
||||
var val/*:any*/ = ({}/*:any*/);
|
||||
if(R.n === 'EOF') val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
|
||||
else val = /*::(*/slurp(R, blob, length, opts)/*:: :any)*/;
|
||||
var Rn = R.n;
|
||||
if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
|
||||
else val = /*::(*/slurp(RecordType, R, blob, length, opts)/*:: :any)*/;
|
||||
/*:: val = (val:any); */
|
||||
if(file_depth == 0 && Rn != 'BOF') continue;
|
||||
/* nested switch statements to workaround V8 128 limit */
|
||||
switch(Rn) {
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
switch(RecordType) {
|
||||
/* Workbook Options */
|
||||
case 'Date1904':
|
||||
case 0x0022 /* Date1904 */:
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
case 'WriteProtect': wb.opts.WriteProtect = true; break;
|
||||
case 'FilePass':
|
||||
case 0x0086 /* WriteProtect */: wb.opts.WriteProtect = true; break;
|
||||
case 0x002f /* FilePass */:
|
||||
if(!opts.enc) blob.l = 0;
|
||||
opts.enc = val;
|
||||
if(!options.password) throw new Error("File is password-protected");
|
||||
if(val.valid == null) throw new Error("Encryption scheme unsupported");
|
||||
if(!val.valid) throw new Error("Password is incorrect");
|
||||
break;
|
||||
case 'WriteAccess': opts.lastuser = val; break;
|
||||
case 'FileSharing': break; //TODO
|
||||
case 'CodePage':
|
||||
case 0x005c /* WriteAccess */: opts.lastuser = val; break;
|
||||
case 0x005b /* FileSharing */: break; //TODO
|
||||
case 0x0042 /* CodePage */:
|
||||
var cpval = Number(val);
|
||||
/* overrides based on test cases */
|
||||
switch(cpval) {
|
||||
@ -253,44 +252,43 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
set_cp(opts.codepage = cpval);
|
||||
seen_codepage = true;
|
||||
break;
|
||||
case 'RRTabId': opts.rrtabid = val; break;
|
||||
case 'WinProtect': opts.winlocked = val; break;
|
||||
case 'Template': break; // TODO
|
||||
case 'BookBool': break; // TODO
|
||||
case 'UsesELFs': break;
|
||||
case 'MTRSettings': break;
|
||||
case 'RefreshAll':
|
||||
case 'CalcCount':
|
||||
case 'CalcDelta':
|
||||
case 'CalcIter':
|
||||
case 'CalcMode':
|
||||
case 'CalcPrecision':
|
||||
case 'CalcSaveRecalc':
|
||||
wb.opts[Rn] = val; break;
|
||||
case 'CalcRefMode': opts.CalcRefMode = val; break; // TODO: implement R1C1
|
||||
case 'Uncalced': break;
|
||||
case 'ForceFullCalculation': wb.opts.FullCalc = val; break;
|
||||
case 'WsBool':
|
||||
case 0x013d /* RRTabId */: opts.rrtabid = val; break;
|
||||
case 0x0019 /* WinProtect */: opts.winlocked = val; break;
|
||||
case 0x0060 /* Template */: break; // TODO
|
||||
case 0x00da /* BookBool */: break; // TODO
|
||||
case 0x0160 /* UsesELFs */: break;
|
||||
case 0x089a /* MTRSettings */: break;
|
||||
case 0x01b7 /* RefreshAll */: wb.opts["RefreshAll"] = val; break;
|
||||
case 0x000c /* CalcCount */: wb.opts["CalcCount"] = val; break;
|
||||
case 0x0010 /* CalcDelta */: wb.opts["CalcDelta"] = val; break;
|
||||
case 0x0011 /* CalcIter */: wb.opts["CalcIter"] = val; break;
|
||||
case 0x000d /* CalcMode */: wb.opts["CalcMode"] = val; break;
|
||||
case 0x000e /* CalcPrecision */: wb.opts["CalcPrecision"] = val; break;
|
||||
case 0x005f /* CalcSaveRecalc */: wb.opts["CalcSaveRecalc"] = val; break;
|
||||
case 0x000f /* CalcRefMode */: opts.CalcRefMode = val; break; // TODO: implement R1C1
|
||||
case 0x005e /* Uncalced */: break;
|
||||
case 0x08a3 /* ForceFullCalculation */: wb.opts.FullCalc = val; break;
|
||||
case 0x0081 /* WsBool */:
|
||||
if(val.fDialog) out["!type"] = "dialog";
|
||||
if(!val.fBelow) (out["!outline"] || (out["!outline"] = {})).above = true;
|
||||
if(!val.fRight) (out["!outline"] || (out["!outline"] = {})).left = true;
|
||||
break; // TODO
|
||||
case 'XF':
|
||||
case 0x00e0 /* XF */:
|
||||
XFs.push(val); break;
|
||||
case 'ExtSST': break; // TODO
|
||||
case 'BookExt': break; // TODO
|
||||
case 'RichTextStream': break;
|
||||
case 'BkHim': break;
|
||||
case 0x00ff /* ExtSST */: break; // TODO
|
||||
case 0x0863 /* BookExt */: break; // TODO
|
||||
case 0x08a6 /* RichTextStream */: break;
|
||||
case 0x00e9 /* BkHim */: break;
|
||||
|
||||
case 'SupBook':
|
||||
case 0x01ae /* SupBook */:
|
||||
supbooks.push([val]);
|
||||
supbooks[supbooks.length-1].XTI = [];
|
||||
break;
|
||||
case 'ExternName':
|
||||
case 0x0023: case 0x0223 /* ExternName */:
|
||||
supbooks[supbooks.length-1].push(val);
|
||||
break;
|
||||
case 'Index': break; // TODO
|
||||
case 'Lbl':
|
||||
case 0x000b: case 0x020b /* Index */: break; // TODO
|
||||
case 0x0018: case 0x0218 /* Lbl */:
|
||||
last_lbl = ({
|
||||
Name: val.Name,
|
||||
Ref: stringify_formula(val.rgce,range,null,supbooks,opts)
|
||||
@ -303,25 +301,25 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
if(val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d')
|
||||
FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) };
|
||||
break;
|
||||
case 'ExternCount': opts.ExternCount = val; break;
|
||||
case 'ExternSheet':
|
||||
case 0x0016 /* ExternCount */: opts.ExternCount = val; break;
|
||||
case 0x0017 /* ExternSheet */:
|
||||
if(supbooks.length == 0) { supbooks[0] = []; supbooks[0].XTI = []; }
|
||||
supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); supbooks.XTI = supbooks.XTI.concat(val); break;
|
||||
case 'NameCmt':
|
||||
case 0x0894 /* NameCmt */:
|
||||
/* TODO: search for correct name */
|
||||
if(opts.biff < 8) break;
|
||||
if(last_lbl != null) last_lbl.Comment = val[1];
|
||||
break;
|
||||
|
||||
case 'Protect': out["!protect"] = val; break; /* for sheet or book */
|
||||
case 'Password': if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break;
|
||||
case 'Prot4Rev': case 'Prot4RevPass': break; /*TODO: Revision Control*/
|
||||
case 0x0012 /* Protect */: out["!protect"] = val; break; /* for sheet or book */
|
||||
case 0x0013 /* Password */: if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break;
|
||||
case 0x01af /* Prot4Rev */: case 0x01bc /* Prot4RevPass */: break; /*TODO: Revision Control*/
|
||||
|
||||
case 'BoundSheet8': {
|
||||
case 0x0085 /* BoundSheet8 */: {
|
||||
Directory[val.pos] = val;
|
||||
opts.snames.push(val.name);
|
||||
} break;
|
||||
case 'EOF': {
|
||||
case 0x000a /* EOF */: {
|
||||
if(--file_depth) break;
|
||||
if(range.e) {
|
||||
if(range.e.r > 0 && range.e.c > 0) {
|
||||
@ -345,7 +343,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
if(cur_sheet === "") Preamble = out; else Sheets[cur_sheet] = out;
|
||||
out = ((options.dense ? [] : {})/*:any*/);
|
||||
} break;
|
||||
case 'BOF': {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809 /* BOF */: {
|
||||
if(opts.biff === 8) opts.biff = {
|
||||
/*::[*/0x0009/*::]*/:2,
|
||||
/*::[*/0x0209/*::]*/:3,
|
||||
@ -387,26 +385,26 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
wsprops = {Hidden:(Directory[s]||{hs:0}).hs, name:cur_sheet };
|
||||
} break;
|
||||
|
||||
case 'Number': case 'BIFF2NUM': case 'BIFF2INT': {
|
||||
case 0x0203 /* Number */: case 0x0003 /* BIFF2NUM */: case 0x0002 /* BIFF2INT */: {
|
||||
if(out["!type"] == "chart") if(options.dense ? (out[val.r]||[])[val.c]: out[encode_cell({c:val.c, r:val.r})]) ++val.c;
|
||||
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe]||{}, v:val.val, t:'n'}/*:any*/);
|
||||
if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
||||
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
||||
addcell({c:val.c, r:val.r}, temp_val, options);
|
||||
} break;
|
||||
case 'BoolErr': {
|
||||
case 0x0005: case 0x0205 /* BoolErr */: {
|
||||
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.val, t:val.t}/*:any*/);
|
||||
if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
||||
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
||||
addcell({c:val.c, r:val.r}, temp_val, options);
|
||||
} break;
|
||||
case 'RK': {
|
||||
case 0x027e /* RK */: {
|
||||
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.rknum, t:'n'}/*:any*/);
|
||||
if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
||||
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
||||
addcell({c:val.c, r:val.r}, temp_val, options);
|
||||
} break;
|
||||
case 'MulRk': {
|
||||
case 0x00bd /* MulRk */: {
|
||||
for(var j = val.c; j <= val.C; ++j) {
|
||||
var ixfe = val.rkrec[j-val.c][0];
|
||||
temp_val= ({ixfe:ixfe, XF:XFs[ixfe], v:val.rkrec[j-val.c][1], t:'n'}/*:any*/);
|
||||
@ -415,7 +413,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
addcell({c:j, r:val.r}, temp_val, options);
|
||||
}
|
||||
} break;
|
||||
case 'Formula': {
|
||||
case 0x0006: case 0x0206: case 0x0406 /* Formula */: {
|
||||
if(val.val == 'String') { last_formula = val; break; }
|
||||
temp_val = make_cell(val.val, val.cell.ixfe, val.tt);
|
||||
temp_val.XF = XFs[temp_val.ixfe];
|
||||
@ -433,7 +431,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
addcell(val.cell, temp_val, options);
|
||||
last_formula = val;
|
||||
} break;
|
||||
case 'String': {
|
||||
case 0x0007: case 0x0207 /* String */: {
|
||||
if(last_formula) { /* technically always true */
|
||||
last_formula.val = val;
|
||||
temp_val = make_cell(val, last_formula.cell.ixfe, 's');
|
||||
@ -447,7 +445,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
last_formula = null;
|
||||
} else throw new Error("String record expects Formula");
|
||||
} break;
|
||||
case 'Array': {
|
||||
case 0x0021: case 0x0221 /* Array */: {
|
||||
arrayf.push(val);
|
||||
var _arraystart = encode_cell(val[0].s);
|
||||
cc = options.dense ? (out[val[0].s.r]||[])[val[0].s.c] : out[_arraystart];
|
||||
@ -458,7 +456,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
cc.F = encode_range(val[0]);
|
||||
}
|
||||
} break;
|
||||
case 'ShrFmla': {
|
||||
case 0x04bc /* ShrFmla */: {
|
||||
if(!options.cellFormula) break;
|
||||
if(last_cell) {
|
||||
/* TODO: capture range */
|
||||
@ -468,7 +466,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
(cc||{}).f = ""+stringify_formula(val[0], range, lastcell, supbooks, opts);
|
||||
}
|
||||
} break;
|
||||
case 'LabelSst':
|
||||
case 0x00fd /* LabelSst */:
|
||||
temp_val=make_cell(sst[val.isst].t, val.ixfe, 's');
|
||||
if(sst[val.isst].h) temp_val.h = sst[val.isst].h;
|
||||
temp_val.XF = XFs[temp_val.ixfe];
|
||||
@ -476,13 +474,13 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
||||
addcell({c:val.c, r:val.r}, temp_val, options);
|
||||
break;
|
||||
case 'Blank': if(options.sheetStubs) {
|
||||
case 0x0201 /* Blank */: if(options.sheetStubs) {
|
||||
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], t:'z'}/*:any*/);
|
||||
if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
||||
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
||||
addcell({c:val.c, r:val.r}, temp_val, options);
|
||||
} break;
|
||||
case 'MulBlank': if(options.sheetStubs) {
|
||||
case 0x00be /* MulBlank */: if(options.sheetStubs) {
|
||||
for(var _j = val.c; _j <= val.C; ++_j) {
|
||||
var _ixfe = val.ixfe[_j-val.c];
|
||||
temp_val= ({ixfe:_ixfe, XF:XFs[_ixfe], t:'z'}/*:any*/);
|
||||
@ -491,8 +489,8 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
addcell({c:_j, r:val.r}, temp_val, options);
|
||||
}
|
||||
} break;
|
||||
case 'RString':
|
||||
case 'Label': case 'BIFF2STR':
|
||||
case 0x00d6 /* RString */:
|
||||
case 0x0204 /* Label */: case 0x0004 /* BIFF2STR */:
|
||||
temp_val=make_cell(val.val, val.ixfe, 's');
|
||||
temp_val.XF = XFs[temp_val.ixfe];
|
||||
if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
||||
@ -500,13 +498,13 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
addcell({c:val.c, r:val.r}, temp_val, options);
|
||||
break;
|
||||
|
||||
case 'Dimensions': {
|
||||
case 0x0000: case 0x0200 /* Dimensions */: {
|
||||
if(file_depth === 1) range = val; /* TODO: stack */
|
||||
} break;
|
||||
case 'SST': {
|
||||
case 0x00fc /* SST */: {
|
||||
sst = val;
|
||||
} break;
|
||||
case 'Format': { /* val = [id, fmt] */
|
||||
case 0x041e /* Format */: { /* val = [id, fmt] */
|
||||
if(opts.biff == 4) {
|
||||
BIFF2FmtTable[BIFF2Fmt++] = val[1];
|
||||
for(var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if(SSF._table[b4idx] == val[1]) break;
|
||||
@ -514,26 +512,26 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
}
|
||||
else SSF.load(val[1], val[0]);
|
||||
} break;
|
||||
case 'BIFF2FORMAT': {
|
||||
case 0x001e /* BIFF2FORMAT */: {
|
||||
BIFF2FmtTable[BIFF2Fmt++] = val;
|
||||
for(var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if(SSF._table[b2idx] == val) break;
|
||||
if(b2idx >= 163) SSF.load(val, BIFF2Fmt + 163);
|
||||
} break;
|
||||
|
||||
case 'MergeCells': merges = merges.concat(val); break;
|
||||
case 0x00e5 /* MergeCells */: merges = merges.concat(val); break;
|
||||
|
||||
case 'Obj': objects[val.cmo[0]] = opts.lastobj = val; break;
|
||||
case 'TxO': opts.lastobj.TxO = val; break;
|
||||
case 'ImData': opts.lastobj.ImData = val; break;
|
||||
case 0x005d /* Obj */: objects[val.cmo[0]] = opts.lastobj = val; break;
|
||||
case 0x01b6 /* TxO */: opts.lastobj.TxO = val; break;
|
||||
case 0x007f /* ImData */: opts.lastobj.ImData = val; break;
|
||||
|
||||
case 'HLink': {
|
||||
case 0x01b8 /* HLink */: {
|
||||
for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
|
||||
for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
|
||||
cc = options.dense ? (out[rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})];
|
||||
if(cc) cc.l = val[1];
|
||||
}
|
||||
} break;
|
||||
case 'HLinkTooltip': {
|
||||
case 0x0800 /* HLinkTooltip */: {
|
||||
for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
|
||||
for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
|
||||
cc = options.dense ? (out[rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})];
|
||||
@ -542,7 +540,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
} break;
|
||||
|
||||
/* Comments */
|
||||
case 'Note': {
|
||||
case 0x001c /* Note */: {
|
||||
if(opts.biff <= 5 && opts.biff >= 2) break; /* TODO: BIFF5 */
|
||||
cc = options.dense ? (out[val[0].r]||[])[val[0].c] : out[encode_cell(val[0])];
|
||||
var noteobj = objects[val[2]];
|
||||
@ -563,14 +561,13 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
cc.c.push(cmnt);
|
||||
} break;
|
||||
|
||||
default: switch(R.n) { /* nested */
|
||||
case 'ClrtClient': break;
|
||||
case 'XFExt': update_xfext(XFs[val.ixfe], val.ext); break;
|
||||
case 0x105c /* ClrtClient */: break;
|
||||
case 0x087d /* XFExt */: update_xfext(XFs[val.ixfe], val.ext); break;
|
||||
|
||||
case 'DefColWidth': defwidth = val; break;
|
||||
case 'DefaultRowHeight': defheight = val[1]; break; // TODO: flags
|
||||
case 0x0055 /* DefColWidth */: defwidth = val; break;
|
||||
case 0x0225 /* DefaultRowHeight */: defheight = val[1]; break; // TODO: flags
|
||||
|
||||
case 'ColInfo': {
|
||||
case 0x007d /* ColInfo */: {
|
||||
if(!opts.cellStyles) break;
|
||||
while(val.e >= val.s) {
|
||||
colinfo[val.e--] = { width: val.w/256, level: (val.level || 0), hidden: !!(val.flags & 1) };
|
||||
@ -578,7 +575,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
process_col(colinfo[val.e+1]);
|
||||
}
|
||||
} break;
|
||||
case 'Row': {
|
||||
case 0x0208 /* Row */: {
|
||||
var rowobj = {};
|
||||
if(val.level != null) { rowinfo[val.r] = rowobj; rowobj.level = val.level; }
|
||||
if(val.hidden) { rowinfo[val.r] = rowobj; rowobj.hidden = true; }
|
||||
@ -588,267 +585,261 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'LeftMargin':
|
||||
case 'RightMargin':
|
||||
case 'TopMargin':
|
||||
case 'BottomMargin':
|
||||
case 0x0026 /* LeftMargin */:
|
||||
case 0x0027 /* RightMargin */:
|
||||
case 0x0028 /* TopMargin */:
|
||||
case 0x0029 /* BottomMargin */:
|
||||
if(!out['!margins']) default_margins(out['!margins'] = {});
|
||||
out['!margins'][Rn.slice(0,-6).toLowerCase()] = val;
|
||||
out['!margins'][({0x26: "left", 0x27:"right", 0x28:"top", 0x29:"bottom"})[RecordType]] = val;
|
||||
break;
|
||||
|
||||
case 'Selection': break;
|
||||
case 0x001d /* Selection */: break;
|
||||
|
||||
case 'Setup': // TODO
|
||||
case 0x00a1 /* Setup */: // TODO
|
||||
if(!out['!margins']) default_margins(out['!margins'] = {});
|
||||
out['!margins'].header = val.header;
|
||||
out['!margins'].footer = val.footer;
|
||||
break;
|
||||
|
||||
case 'Window2': // TODO
|
||||
case 0x023e /* Window2 */: // TODO
|
||||
// $FlowIgnore
|
||||
if(val.RTL) Workbook.Views[0].RTL = true;
|
||||
break;
|
||||
|
||||
case 'Header': break; // TODO
|
||||
case 'Footer': break; // TODO
|
||||
case 'HCenter': break; // TODO
|
||||
case 'VCenter': break; // TODO
|
||||
case 'Pls': break; // TODO
|
||||
case 'GCW': break;
|
||||
case 'LHRecord': break;
|
||||
case 'DBCell': break; // TODO
|
||||
case 'EntExU2': break; // TODO
|
||||
case 'SxView': break; // TODO
|
||||
case 'Sxvd': break; // TODO
|
||||
case 'SXVI': break; // TODO
|
||||
case 'SXVDEx': break; // TODO
|
||||
case 'SxIvd': break; // TODO
|
||||
case 'SXString': break; // TODO
|
||||
case 'Sync': break;
|
||||
case 'Addin': break;
|
||||
case 'SXDI': break; // TODO
|
||||
case 'SXLI': break; // TODO
|
||||
case 'SXEx': break; // TODO
|
||||
case 'QsiSXTag': break; // TODO
|
||||
case 'Feat': break;
|
||||
case 'FeatHdr': case 'FeatHdr11': break;
|
||||
case 'Feature11': case 'Feature12': case 'List12': break;
|
||||
case 'Country': country = val; break;
|
||||
case 'RecalcId': break;
|
||||
case 'DxGCol': break; // TODO: htmlify
|
||||
case 'Fbi': case 'Fbi2': case 'GelFrame': break;
|
||||
case 'Font': break; // TODO
|
||||
case 'XFCRC': break; // TODO
|
||||
case 'Style': break; // TODO
|
||||
case 'StyleExt': break; // TODO
|
||||
case 'Palette': palette = val; break;
|
||||
case 'Theme': themes = val; break;
|
||||
case 0x0014 /* Header */: // TODO
|
||||
case 0x0015 /* Footer */: // TODO
|
||||
case 0x0083 /* HCenter */: // TODO
|
||||
case 0x0084 /* VCenter */: // TODO
|
||||
case 0x004d /* Pls */: // TODO
|
||||
case 0x00ab /* GCW */:
|
||||
case 0x0094 /* LHRecord */:
|
||||
case 0x00d7 /* DBCell */: // TODO
|
||||
case 0x01c2 /* EntExU2 */: // TODO
|
||||
case 0x00b0 /* SxView */: // TODO
|
||||
case 0x00b1 /* Sxvd */: // TODO
|
||||
case 0x00b2 /* SXVI */: // TODO
|
||||
case 0x0100 /* SXVDEx */: // TODO
|
||||
case 0x00b4 /* SxIvd */: // TODO
|
||||
case 0x00cd /* SXString */: // TODO
|
||||
case 0x0097 /* Sync */:
|
||||
case 0x0087 /* Addin */:
|
||||
case 0x00c5 /* SXDI */: // TODO
|
||||
case 0x00b5 /* SXLI */: // TODO
|
||||
case 0x00f1 /* SXEx */: // TODO
|
||||
case 0x0802 /* QsiSXTag */: // TODO
|
||||
case 0x0868 /* Feat */:
|
||||
case 0x0867 /* FeatHdr */: case 0x0871 /* FeatHdr11 */:
|
||||
case 0x0872 /* Feature11 */: case 0x0878 /* Feature12 */: case 0x0877 /* List12 */: break;
|
||||
case 0x008c /* Country */: country = val; break;
|
||||
case 0x01c1 /* RecalcId */:
|
||||
case 0x0099 /* DxGCol */: // TODO: htmlify
|
||||
case 0x1060 /* Fbi */: case 0x1068 /* Fbi2 */: case 0x1066 /* GelFrame */:
|
||||
case 0x0031 /* Font */: // TODO
|
||||
case 0x087c /* XFCRC */: // TODO
|
||||
case 0x0293 /* Style */: // TODO
|
||||
case 0x0892 /* StyleExt */: break; // TODO
|
||||
case 0x0092 /* Palette */: palette = val; break;
|
||||
case 0x0896 /* Theme */: themes = val; break;
|
||||
/* Protection */
|
||||
case 'ScenarioProtect': break;
|
||||
case 'ObjProtect': break;
|
||||
case 0x00dd /* ScenarioProtect */:
|
||||
case 0x0063 /* ObjProtect */: break;
|
||||
|
||||
/* Conditional Formatting */
|
||||
case 'CondFmt12': break;
|
||||
case 0x0879 /* CondFmt12 */:
|
||||
|
||||
/* Table */
|
||||
case 'Table': break; // TODO
|
||||
case 'TableStyles': break; // TODO
|
||||
case 'TableStyle': break; // TODO
|
||||
case 'TableStyleElement': break; // TODO
|
||||
case 0x0236 /* Table */: // TODO
|
||||
case 0x088e /* TableStyles */: // TODO
|
||||
case 0x088f /* TableStyle */: // TODO
|
||||
case 0x0890 /* TableStyleElement */: // TODO
|
||||
|
||||
/* PivotTable */
|
||||
case 'SXStreamID': break; // TODO
|
||||
case 'SXVS': break; // TODO
|
||||
case 'DConRef': break; // TODO
|
||||
case 'SXAddl': break; // TODO
|
||||
case 'DConBin': break; // TODO
|
||||
case 'DConName': break; // TODO
|
||||
case 'SXPI': break; // TODO
|
||||
case 'SxFormat': break; // TODO
|
||||
case 'SxSelect': break; // TODO
|
||||
case 'SxRule': break; // TODO
|
||||
case 'SxFilt': break; // TODO
|
||||
case 'SxItm': break; // TODO
|
||||
case 'SxDXF': break; // TODO
|
||||
case 0x00d5 /* SXStreamID */: // TODO
|
||||
case 0x00e3 /* SXVS */: // TODO
|
||||
case 0x0051 /* DConRef */: // TODO
|
||||
case 0x0864 /* SXAddl */: // TODO
|
||||
case 0x01b5 /* DConBin */: // TODO
|
||||
case 0x0052 /* DConName */: // TODO
|
||||
case 0x00b6 /* SXPI */: // TODO
|
||||
case 0x00fb /* SxFormat */: // TODO
|
||||
case 0x00f7 /* SxSelect */: // TODO
|
||||
case 0x00f0 /* SxRule */: // TODO
|
||||
case 0x00f2 /* SxFilt */: // TODO
|
||||
case 0x00f5 /* SxItm */: // TODO
|
||||
case 0x00f4 /* SxDXF */: // TODO
|
||||
|
||||
/* Scenario Manager */
|
||||
case 'ScenMan': break;
|
||||
case 0x00ae /* ScenMan */:
|
||||
|
||||
/* Data Consolidation */
|
||||
case 'DCon': break;
|
||||
case 0x0050 /* DCon */:
|
||||
|
||||
/* Watched Cell */
|
||||
case 'CellWatch': break;
|
||||
case 0x086c /* CellWatch */:
|
||||
|
||||
/* Print Settings */
|
||||
case 'PrintRowCol': break;
|
||||
case 'PrintGrid': break;
|
||||
case 'PrintSize': break;
|
||||
case 0x002a /* PrintRowCol */:
|
||||
case 0x002b /* PrintGrid */:
|
||||
case 0x0033 /* PrintSize */:
|
||||
|
||||
case 'XCT': break;
|
||||
case 'CRN': break;
|
||||
case 0x0059 /* XCT */:
|
||||
case 0x005a /* CRN */:
|
||||
|
||||
case 'Scl': {
|
||||
case 0x00a0 /* Scl */: {
|
||||
//console.log("Zoom Level:", val[0]/val[1],val);
|
||||
} break;
|
||||
case 'SheetExt': {
|
||||
}
|
||||
case 0x0862 /* SheetExt */: {
|
||||
/* empty */
|
||||
} break;
|
||||
case 'SheetExtOptional': {
|
||||
/* empty */
|
||||
} break;
|
||||
}
|
||||
|
||||
/* VBA */
|
||||
case 'ObNoMacros': {
|
||||
case 0x01bd /* ObNoMacros */: {
|
||||
/* empty */
|
||||
} break;
|
||||
case 'ObProj': {
|
||||
}
|
||||
case 0x00d3 /* ObProj */: {
|
||||
/* empty */
|
||||
} break;
|
||||
case 'CodeName': {
|
||||
}
|
||||
case 0x01ba /* CodeName */: {
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook";
|
||||
else wsprops.CodeName = val || wsprops.name;
|
||||
} break;
|
||||
case 'GUIDTypeLib': {
|
||||
}
|
||||
case 0x0897 /* GUIDTypeLib */: {
|
||||
/* empty */
|
||||
} break;
|
||||
}
|
||||
|
||||
case 'WOpt': break; // TODO: WTF?
|
||||
case 'PhoneticInfo': break;
|
||||
case 0x080b /* WOpt */: // TODO: WTF?
|
||||
case 0x00ef /* PhoneticInfo */:
|
||||
|
||||
case 'OleObjectSize': break;
|
||||
case 0x00de /* OleObjectSize */:
|
||||
|
||||
/* Differential Formatting */
|
||||
case 'DXF': case 'DXFN': case 'DXFN12': case 'DXFN12List': case 'DXFN12NoCB': break;
|
||||
case 0x088d /* DXF */:
|
||||
|
||||
/* Data Validation */
|
||||
case 'Dv': case 'DVal': break;
|
||||
case 0x01be /* Dv */: case 0x01b2 /* DVal */:
|
||||
|
||||
/* Data Series */
|
||||
case 'BRAI': case 'Series': case 'SeriesText': break;
|
||||
case 0x1051 /* BRAI */: case 0x1003 /* Series */: case 0x100d /* SeriesText */: break;
|
||||
|
||||
/* Data Connection */
|
||||
case 'DConn': break;
|
||||
case 'DbOrParamQry': break;
|
||||
case 'DBQueryExt': break;
|
||||
case 0x0876 /* DConn */:
|
||||
case 0x00dc /* DbOrParamQry */:
|
||||
case 0x0803 /* DBQueryExt */:
|
||||
|
||||
case 'OleDbConn': break;
|
||||
case 'ExtString': break;
|
||||
case 0x080a /* OleDbConn */:
|
||||
case 0x0804 /* ExtString */:
|
||||
|
||||
/* Formatting */
|
||||
case 'IFmtRecord': break;
|
||||
case 'CondFmt': case 'CF': case 'CF12': case 'CFEx': break;
|
||||
case 0x104e /* IFmtRecord */:
|
||||
case 0x01b0 /* CondFmt */: case 0x01b1 /* CF */: case 0x087a /* CF12 */: case 0x087b /* CFEx */:
|
||||
|
||||
/* Explicitly Ignored */
|
||||
case 'Excel9File': break;
|
||||
case 'Units': break;
|
||||
case 'InterfaceHdr': case 'Mms': case 'InterfaceEnd': case 'DSF': break;
|
||||
case 'BuiltInFnGroupCount': /* 2.4.30 0x0E or 0x10 but excel 2011 generates 0x11? */ break;
|
||||
case 0x01c0 /* Excel9File */:
|
||||
case 0x1001 /* Units */:
|
||||
case 0x00e1 /* InterfaceHdr' */: case 0x00c1 /* Mms */: case 0x00e2 /* InterfaceEnd */: case 0x0161 /* DSF */:
|
||||
case 0x009c /* BuiltInFnGroupCount */: /* 2.4.30 0x0E or 0x10 but excel 2011 generates 0x11? */ break;
|
||||
/* View Stuff */
|
||||
case 'Window1': case 'HideObj': case 'GridSet': case 'Guts':
|
||||
case 'UserBView': case 'UserSViewBegin': case 'UserSViewEnd': break;
|
||||
case 'Pane': break;
|
||||
default: switch(R.n) { /* nested */
|
||||
case 0x003d /* Window1 */: case 0x008d /* HideObj */: case 0x0082 /* GridSet */: case 0x0080 /* Guts */:
|
||||
case 0x01a9 /* UserBView */: case 0x01aa /* UserSViewBegin */: case 0x01aa /* UserSViewEnd */:
|
||||
case 0x0041 /* Pane */:
|
||||
/* Chart */
|
||||
case 'Dat':
|
||||
case 'Begin': case 'End':
|
||||
case 'StartBlock': case 'EndBlock':
|
||||
case 'Frame': case 'Area':
|
||||
case 'Axis': case 'AxisLine': case 'Tick': break;
|
||||
case 'AxesUsed':
|
||||
case 'CrtLayout12': case 'CrtLayout12A': case 'CrtLink': case 'CrtLine': case 'CrtMlFrt': case 'CrtMlFrtContinue': break;
|
||||
case 'LineFormat': case 'AreaFormat':
|
||||
case 'Chart': case 'Chart3d': case 'Chart3DBarShape': case 'ChartFormat': case 'ChartFrtInfo': break;
|
||||
case 'PlotArea': case 'PlotGrowth': break;
|
||||
case 'SeriesList': case 'SerParent': case 'SerAuxTrend': break;
|
||||
case 'DataFormat': case 'SerToCrt': case 'FontX': break;
|
||||
case 'CatSerRange': case 'AxcExt': case 'SerFmt': break;
|
||||
case 'ShtProps': break;
|
||||
case 'DefaultText': case 'Text': case 'CatLab': break;
|
||||
case 'DataLabExtContents': break;
|
||||
case 'Legend': case 'LegendException': break;
|
||||
case 'Pie': case 'Scatter': break;
|
||||
case 'PieFormat': case 'MarkerFormat': break;
|
||||
case 'StartObject': case 'EndObject': break;
|
||||
case 'AlRuns': case 'ObjectLink': break;
|
||||
case 'SIIndex': break;
|
||||
case 'AttachedLabel': case 'YMult': break;
|
||||
case 0x1063 /* Dat */:
|
||||
case 0x1033 /* Begin */: case 0x1033 /* End */:
|
||||
case 0x0852 /* StartBlock */: case 0x0853 /* EndBlock */: break;
|
||||
case 0x1032 /* Frame */: case 0x101a /* Area */:
|
||||
case 0x101d /* Axis */: case 0x1021 /* AxisLine */: case 0x101e /* Tick */:
|
||||
case 0x1046 /* AxesUsed */:
|
||||
case 0x089d /* CrtLayout12 */: case 0x08a7 /* CrtLayout12A */: case 0x1022 /* CrtLink */: case 0x101c /* CrtLine */: case 0x089e /* CrtMlFrt */: case 0x089f /* CrtMlFrtContinue */:
|
||||
case 0x1007 /* LineFormat */: case 0x100a /* AreaFormat */:
|
||||
case 0x1002 /* Chart */: case 0x103a /* Chart3d */: case 0x105f /* Chart3DBarShape */: case 0x1014 /* ChartFormat */: case 0x0850 /* ChartFrtInfo */:
|
||||
case 0x1035 /* PlotArea */: case 0x1064 /* PlotGrowth */:
|
||||
case 0x1016 /* SeriesList */: case 0x104a /* SerParent */: case 0x104b /* SerAuxTrend */:
|
||||
case 0x1006 /* DataFormat */: case 0x1045 /* SerToCrt */: case 0x1026 /* FontX */:
|
||||
case 0x1020 /* CatSerRange */: case 0x1062 /* AxcExt */: case 0x105d /* SerFmt */:
|
||||
case 0x1044 /* ShtProps */:
|
||||
case 0x1024 /* DefaultText */: case 0x1025 /* Text */: case 0x0856 /* CatLab */:
|
||||
case 0x086b /* DataLabExtContents */:
|
||||
case 0x1015 /* Legend */: case 0x1043 /* LegendException */:
|
||||
case 0x1019 /* Pie */: case 0x101b /* Scatter */:
|
||||
case 0x100b /* PieFormat */: case 0x1009 /* MarkerFormat */:
|
||||
case 0x0854 /* StartObject */: case 0x0855 /* EndObject */:
|
||||
case 0x1050 /* AlRuns */: case 0x1027 /* ObjectLink */:
|
||||
case 0x1065 /* SIIndex */:
|
||||
case 0x100c /* AttachedLabel */: case 0x0857 /* YMult */:
|
||||
|
||||
/* Chart Group */
|
||||
case 'Line': case 'Bar': break;
|
||||
case 'Surf': break;
|
||||
case 0x1018 /* Line */: case 0x1017 /* Bar */:
|
||||
case 0x103f /* Surf */:
|
||||
|
||||
/* Axis Group */
|
||||
case 'AxisParent': break;
|
||||
case 'Pos': break;
|
||||
case 'ValueRange': break;
|
||||
case 0x1041 /* AxisParent */:
|
||||
case 0x104f /* Pos */:
|
||||
case 0x101f /* ValueRange */:
|
||||
|
||||
/* Pivot Chart */
|
||||
case 'SXViewEx9': break; // TODO
|
||||
case 'SXViewLink': break;
|
||||
case 'PivotChartBits': break;
|
||||
case 'SBaseRef': break;
|
||||
case 'TextPropsStream': break;
|
||||
case 0x0810 /* SXViewEx9 */: // TODO
|
||||
case 0x0858 /* SXViewLink */:
|
||||
case 0x0859 /* PivotChartBits */:
|
||||
case 0x1048 /* SBaseRef */:
|
||||
case 0x08a5 /* TextPropsStream */:
|
||||
|
||||
/* Chart Misc */
|
||||
case 'LnExt': break;
|
||||
case 'MkrExt': break;
|
||||
case 'CrtCoopt': break;
|
||||
case 0x08c9 /* LnExt */:
|
||||
case 0x08ca /* MkrExt */:
|
||||
case 0x08cb /* CrtCoopt */:
|
||||
|
||||
/* Query Table */
|
||||
case 'Qsi': case 'Qsif': case 'Qsir': case 'QsiSXTag': break;
|
||||
case 'TxtQry': break;
|
||||
case 0x01ad /* Qsi */: case 0x0807 /* Qsif */: case 0x0806 /* Qsir */: case 0x0802 /* QsiSXTag */:
|
||||
case 0x0805 /* TxtQry */:
|
||||
|
||||
/* Filter */
|
||||
case 'FilterMode': break;
|
||||
case 'AutoFilter': case 'AutoFilterInfo': break;
|
||||
case 'AutoFilter12': break;
|
||||
case 'DropDownObjIds': break;
|
||||
case 'Sort': break;
|
||||
case 'SortData': break;
|
||||
case 0x009b /* FilterMode */:
|
||||
case 0x009e /* AutoFilter */: case 0x009d /* AutoFilterInfo */:
|
||||
case 0x087e /* AutoFilter12 */:
|
||||
case 0x0874 /* DropDownObjIds */:
|
||||
case 0x0090 /* Sort */:
|
||||
case 0x0895 /* SortData */:
|
||||
|
||||
/* Drawing */
|
||||
case 'ShapePropsStream': break;
|
||||
case 'MsoDrawing': case 'MsoDrawingGroup': case 'MsoDrawingSelection': break;
|
||||
case 0x08a4 /* ShapePropsStream */:
|
||||
case 0x00ec /* MsoDrawing */: case 0x00eb /* MsoDrawingGroup*/: case 0x00ed /* MsoDrawingSelection */:
|
||||
/* Pub Stuff */
|
||||
case 'WebPub': case 'AutoWebPub': break;
|
||||
case 0x0801 /* WebPub */: case 0x08c0 /* AutoWebPub */:
|
||||
|
||||
/* Print Stuff */
|
||||
case 'HeaderFooter': case 'HFPicture': case 'PLV':
|
||||
case 'HorizontalPageBreaks': case 'VerticalPageBreaks': break;
|
||||
case 0x089c /* HeaderFooter */: case 0x0866 /* HFPicture */: case 0x088b /* PLV */:
|
||||
case 0x001b /* HorizontalPageBreaks */: case 0x001a /* VerticalPageBreaks */:
|
||||
/* Behavioral */
|
||||
case 'Backup': case 'CompressPictures': case 'Compat12': break;
|
||||
case 0x0040 /* Backup */: case 0x089b /* CompressPictures */: case 0x088c /* Compat12 */:
|
||||
|
||||
/* Should not Happen */
|
||||
case 'Continue': case 'ContinueFrt12': break;
|
||||
case 0x003c /* 'Continue' */: case 0x087f /* 'ContinueFrt12' */:
|
||||
|
||||
/* Future Records */
|
||||
case 'FrtFontList': case 'FrtWrapper': break;
|
||||
case 0x085a /* FrtFontList */: case 0x0851 /* 'FrtWrapper' */:
|
||||
|
||||
default: switch(R.n) { /* nested */
|
||||
/* BIFF5 records */
|
||||
case 'TabIdConf': case 'Radar': case 'RadarArea': case 'DropBar': case 'Intl': case 'CoordList': case 'SerAuxErrBar': break;
|
||||
case 0x00ea /* TabIdConf */: case 0x103e /* Radar */: case 0x1040 /* RadarArea */: case 0x103d /* DropBar */: case 'Intl': case 'CoordList': case 'SerAuxErrBar':
|
||||
|
||||
/* BIFF2-4 records */
|
||||
case 'BIFF2FONTCLR': case 'BIFF2FMTCNT': case 'BIFF2FONTXTRA': break;
|
||||
case 'BIFF2XF': case 'BIFF3XF': case 'BIFF4XF': break;
|
||||
case 'BIFF2XFINDEX': break;
|
||||
case 'BIFF4FMTCNT': case 'BIFF2ROW': case 'BIFF2WINDOW2': break;
|
||||
case 0x0045 /* BIFF2FONTCLR */: case 0x001f /* BIFF2FMTCNT */: case 0x0032 /* BIFF2FONTXTRA */:
|
||||
case 0x0043 /* BIFF2XF */: case 0x0243 /* BIFF3XF */: case 0x0443 /* BIFF4XF */:
|
||||
case 0x0044 /* BIFF2XFINDEX */:
|
||||
case 0x0056 /* BIFF4FMTCNT */: case 0x0008 /* BIFF2ROW */: case 0x003e /* BIFF2WINDOW2 */:
|
||||
|
||||
/* Miscellaneous */
|
||||
case 'SCENARIO': case 'DConBin': case 'PicF': case 'DataLabExt':
|
||||
case 'Lel': case 'BopPop': case 'BopPopCustom': case 'RealTimeData':
|
||||
case 'Name': break;
|
||||
case 'LHNGraph': case 'FnGroupName': case 'AddMenu': case 'LPr': break;
|
||||
case 'ListObj': case 'ListField': break;
|
||||
case 'RRSort': break;
|
||||
case 'BigName': break;
|
||||
case 'ToolbarHdr': case 'ToolbarEnd': break;
|
||||
case 'DDEObjName': break;
|
||||
case 'FRTArchId$': break;
|
||||
default: if(options.WTF) throw 'Unrecognized Record ' + R.n;
|
||||
}}}}
|
||||
case 0x00af /* SCENARIO */: case 0x01b5 /* DConBin */: case 0x103c /* PicF */: case 0x086a /* DataLabExt */:
|
||||
case 0x01b9 /* Lel */: case 0x1061 /* BopPop */: case 0x1067 /* BopPopCustom */: case 0x0813 /* RealTimeData */:
|
||||
case 0x0095 /* LHNGraph */: case 0x009a /* FnGroupName */: case 0x00c2 /* AddMenu */: case 0x0098 /* LPr */:
|
||||
case 0x08c1 /* ListObj */: case 0x08c2 /* ListField */:
|
||||
case 0x013f /* RRSort */:
|
||||
case 0x0418 /* BigName */:
|
||||
case 0x00bf /* ToolbarHdr */: case 0x00c0/* ToolbarEnd */:
|
||||
case 0x0034 /* DDEObjName */:
|
||||
case 0x08d6 /* FRTArchId$ */: break;
|
||||
default: if(options.WTF) throw 'Unrecognized Record 0x' + RecordType.toString(16);
|
||||
}
|
||||
} else blob.l += length;
|
||||
}
|
||||
wb.SheetNames=keys(Directory).sort(function(a,b) { return Number(a) - Number(b); }).map(function(x){return Directory[x].name;});
|
||||
|
2567
bits/77_parsetab.js
2567
bits/77_parsetab.js
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
function write_biff_rec(ba/*:BufArray*/, type/*:number|string*/, payload, length/*:?number*/)/*:void*/ {
|
||||
var t/*:number*/ = typeof type == "number" ? type : (+type || +XLSRE[/*::String(*/type/*::)*/]);
|
||||
function write_biff_rec(ba/*:BufArray*/, type/*:number*/, payload, length/*:?number*/)/*:void*/ {
|
||||
var t/*:number*/ = type;
|
||||
if(isNaN(t)) return;
|
||||
var len = length || (payload||[]).length || 0;
|
||||
var o = ba.next(4);
|
||||
@ -8,10 +8,10 @@ function write_biff_rec(ba/*:BufArray*/, type/*:number|string*/, payload, length
|
||||
if(/*:: len != null &&*/len > 0 && is_buf(payload)) ba.push(payload);
|
||||
}
|
||||
|
||||
function write_biff_continue(ba/*:BufArray*/, type/*:number|string*/, payload, length/*:?number*/)/*:void*/ {
|
||||
function write_biff_continue(ba/*:BufArray*/, type/*:number*/, payload, length/*:?number*/)/*:void*/ {
|
||||
var len = length || (payload||[]).length || 0;
|
||||
if(len <= 8224) return write_biff_rec(ba, type, payload, len);
|
||||
var t/*:number*/ = +type || +XLSRE[/*::String(*/type/*::)*/];
|
||||
var t = type;
|
||||
if(isNaN(t)) return;
|
||||
var parts = payload.parts || [], sidx = 0;
|
||||
var i = 0, w = 0;
|
||||
@ -113,7 +113,7 @@ function write_biff2_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
|
||||
}
|
||||
|
||||
function write_FONTS_biff8(ba, data, opts) {
|
||||
write_biff_rec(ba, "Font", write_Font({
|
||||
write_biff_rec(ba, 0x0031 /* Font */, write_Font({
|
||||
sz:12,
|
||||
color: {theme:1},
|
||||
name: "Arial",
|
||||
@ -127,7 +127,7 @@ function write_FMTS_biff8(ba, NF/*:?SSFTable*/, opts) {
|
||||
if(!NF) return;
|
||||
[[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) {
|
||||
/*:: if(!NF) return; */
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_biff_rec(ba, "Format", write_Format(i, NF[i], opts));
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_biff_rec(ba, 0x041E /* Format */, write_Format(i, NF[i], opts));
|
||||
});
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ function write_FEAT(ba, ws) {
|
||||
var o = new_buf(19);
|
||||
o.write_shift(4, 0x867); o.write_shift(4, 0); o.write_shift(4, 0);
|
||||
o.write_shift(2, 3); o.write_shift(1, 1); o.write_shift(4, 0);
|
||||
write_biff_rec(ba, "FeatHdr", o);
|
||||
write_biff_rec(ba, 0x0867 /* FeatHdr */, o);
|
||||
/* [MS-XLS] 2.4.111 */
|
||||
o = new_buf(39);
|
||||
o.write_shift(4, 0x868); o.write_shift(4, 0); o.write_shift(4, 0);
|
||||
@ -144,21 +144,21 @@ function write_FEAT(ba, ws) {
|
||||
o.write_shift(2, 1); o.write_shift(4, 4); o.write_shift(2, 0);
|
||||
write_Ref8U(safe_decode_range(ws['!ref']||"A1"), o);
|
||||
o.write_shift(4, 4);
|
||||
write_biff_rec(ba, "Feat", o);
|
||||
write_biff_rec(ba, 0x0868 /* Feat */, o);
|
||||
}
|
||||
|
||||
function write_CELLXFS_biff8(ba, opts) {
|
||||
for(var i = 0; i < 16; ++i) write_biff_rec(ba, "XF", write_XF({numFmtId:0, style:true}, 0, opts));
|
||||
for(var i = 0; i < 16; ++i) write_biff_rec(ba, 0x00e0 /* XF */, write_XF({numFmtId:0, style:true}, 0, opts));
|
||||
opts.cellXfs.forEach(function(c) {
|
||||
write_biff_rec(ba, "XF", write_XF(c, 0, opts));
|
||||
write_biff_rec(ba, 0x00e0 /* XF */, write_XF(c, 0, opts));
|
||||
});
|
||||
}
|
||||
|
||||
function write_ws_biff8_hlinks(ba/*:BufArray*/, ws) {
|
||||
for(var R=0; R<ws['!links'].length; ++R) {
|
||||
var HL = ws['!links'][R];
|
||||
write_biff_rec(ba, "HLink", write_HLink(HL));
|
||||
if(HL[1].Tooltip) write_biff_rec(ba, "HLinkTooltip", write_HLinkTooltip(HL));
|
||||
write_biff_rec(ba, 0x01b8 /* HLink */, write_HLink(HL));
|
||||
if(HL[1].Tooltip) write_biff_rec(ba, 0x0800 /* HLinkTooltip */, write_HLinkTooltip(HL));
|
||||
}
|
||||
delete ws['!links'];
|
||||
}
|
||||
@ -168,7 +168,7 @@ function write_ws_cols_biff8(ba, cols, ws) {
|
||||
var cnt = 0;
|
||||
cols.forEach(function(col, idx) {
|
||||
if(++cnt <= 256 && col) {
|
||||
write_biff_rec(ba, "ColInfo", write_ColInfo(col_obj_w(idx, col), idx));
|
||||
write_biff_rec(ba, 0x007d /* ColInfo */, write_ColInfo(col_obj_w(idx, col), idx));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -176,28 +176,28 @@ function write_ws_cols_biff8(ba, cols, ws) {
|
||||
function write_ws_biff8_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:number*/, opts) {
|
||||
var os = 16 + get_cell_style(opts.cellXfs, cell, opts);
|
||||
if(cell.v == null && !cell.bf) {
|
||||
write_biff_rec(ba, "Blank", write_XLSCell(R, C, os));
|
||||
write_biff_rec(ba, 0x0201 /* Blank */, write_XLSCell(R, C, os));
|
||||
return;
|
||||
}
|
||||
if(cell.bf) write_biff_rec(ba, "Formula", write_Formula(cell, R, C, opts, os));
|
||||
if(cell.bf) write_biff_rec(ba, 0x0006 /* Formula */, write_Formula(cell, R, C, opts, os));
|
||||
else switch(cell.t) {
|
||||
case 'd': case 'n':
|
||||
var v = cell.t == 'd' ? datenum(parseDate(cell.v)) : cell.v;
|
||||
/* TODO: emit RK as appropriate */
|
||||
write_biff_rec(ba, "Number", write_Number(R, C, v, os, opts));
|
||||
write_biff_rec(ba, 0x0203 /* Number */, write_Number(R, C, v, os, opts));
|
||||
break;
|
||||
case 'b': case 'e':
|
||||
write_biff_rec(ba, 0x0205, write_BoolErr(R, C, cell.v, os, opts, cell.t));
|
||||
write_biff_rec(ba, 0x0205 /* BoolErr */, write_BoolErr(R, C, cell.v, os, opts, cell.t));
|
||||
break;
|
||||
/* TODO: codepage, sst */
|
||||
case 's': case 'str':
|
||||
if(opts.bookSST) {
|
||||
var isst = get_sst_id(opts.Strings, cell.v, opts.revStrings);
|
||||
write_biff_rec(ba, "LabelSst", write_LabelSst(R, C, isst, os, opts));
|
||||
} else write_biff_rec(ba, "Label", write_Label(R, C, (cell.v||"").slice(0,255), os, opts));
|
||||
write_biff_rec(ba, 0x00fd /* LabelSst */, write_LabelSst(R, C, isst, os, opts));
|
||||
} else write_biff_rec(ba, 0x0204 /* Label */, write_Label(R, C, (cell.v||"").slice(0,255), os, opts));
|
||||
break;
|
||||
default:
|
||||
write_biff_rec(ba, "Blank", write_XLSCell(R, C, os));
|
||||
write_biff_rec(ba, 0x0201 /* Blank */, write_XLSCell(R, C, os));
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,21 +220,21 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
||||
|
||||
write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts));
|
||||
/* [Uncalced] Index */
|
||||
write_biff_rec(ba, "CalcMode", writeuint16(1));
|
||||
write_biff_rec(ba, "CalcCount", writeuint16(100));
|
||||
write_biff_rec(ba, "CalcRefMode", writebool(true));
|
||||
write_biff_rec(ba, "CalcIter", writebool(false));
|
||||
write_biff_rec(ba, "CalcDelta", write_Xnum(0.001));
|
||||
write_biff_rec(ba, "CalcSaveRecalc", writebool(true));
|
||||
write_biff_rec(ba, "PrintRowCol", writebool(false));
|
||||
write_biff_rec(ba, "PrintGrid", writebool(false));
|
||||
write_biff_rec(ba, "GridSet", writeuint16(1));
|
||||
write_biff_rec(ba, "Guts", write_Guts([0,0]));
|
||||
write_biff_rec(ba, 0x000d /* CalcMode */, writeuint16(1));
|
||||
write_biff_rec(ba, 0x000c /* CalcCount */, writeuint16(100));
|
||||
write_biff_rec(ba, 0x000f /* CalcRefMode */, writebool(true));
|
||||
write_biff_rec(ba, 0x0011 /* CalcIter */, writebool(false));
|
||||
write_biff_rec(ba, 0x0010 /* CalcDelta */, write_Xnum(0.001));
|
||||
write_biff_rec(ba, 0x005f /* CalcSaveRecalc */, writebool(true));
|
||||
write_biff_rec(ba, 0x002a /* PrintRowCol */, writebool(false));
|
||||
write_biff_rec(ba, 0x002b /* PrintGrid */, writebool(false));
|
||||
write_biff_rec(ba, 0x0082 /* GridSet */, writeuint16(1));
|
||||
write_biff_rec(ba, 0x0080 /* Guts */, write_Guts([0,0]));
|
||||
/* DefaultRowHeight WsBool [Sync] [LPr] [HorizontalPageBreaks] [VerticalPageBreaks] */
|
||||
/* Header (string) */
|
||||
/* Footer (string) */
|
||||
write_biff_rec(ba, "HCenter", writebool(false));
|
||||
write_biff_rec(ba, "VCenter", writebool(false));
|
||||
write_biff_rec(ba, 0x0083 /* HCenter */, writebool(false));
|
||||
write_biff_rec(ba, 0x0084 /* VCenter */, writebool(false));
|
||||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"], ws);
|
||||
/* ... */
|
||||
@ -256,17 +256,17 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
||||
}
|
||||
var cname/*:string*/ = _sheet.CodeName || _sheet.name || s;
|
||||
/* ... */
|
||||
if(b8) write_biff_rec(ba, "Window2", write_Window2((_WB.Views||[])[0]));
|
||||
if(b8) write_biff_rec(ba, 0x023e /* Window2 */, write_Window2((_WB.Views||[])[0]));
|
||||
/* ... */
|
||||
if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, "MergeCells", write_MergeCells(ws['!merges']));
|
||||
if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, 0x00e5 /* MergeCells */, write_MergeCells(ws['!merges']));
|
||||
/* [LRng] *QUERYTABLE [PHONETICINFO] CONDFMTS */
|
||||
if(b8) write_ws_biff8_hlinks(ba, ws);
|
||||
/* [DVAL] */
|
||||
write_biff_rec(ba, "CodeName", write_XLUnicodeString(cname, opts));
|
||||
write_biff_rec(ba, 0x01ba /* CodeName */, write_XLUnicodeString(cname, opts));
|
||||
/* *WebPub *CellWatch [SheetExt] */
|
||||
if(b8) write_FEAT(ba, ws);
|
||||
/* *FEAT11 *RECORD12 */
|
||||
write_biff_rec(ba, "EOF");
|
||||
write_biff_rec(ba, 0x000a /* EOF */);
|
||||
return ba.end();
|
||||
}
|
||||
|
||||
@ -278,59 +278,59 @@ function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
|
||||
var _wb/*:WBProps*/ = /*::((*/_WB.WBProps||{/*::CodeName:"ThisWorkbook"*/}/*:: ):any)*/;
|
||||
var b8 = opts.biff == 8, b5 = opts.biff == 5;
|
||||
write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts));
|
||||
if(opts.bookType == "xla") write_biff_rec(A, "Addin");
|
||||
write_biff_rec(A, "InterfaceHdr", b8 ? writeuint16(0x04b0) : null);
|
||||
write_biff_rec(A, "Mms", writezeroes(2));
|
||||
if(b5) write_biff_rec(A, "ToolbarHdr");
|
||||
if(b5) write_biff_rec(A, "ToolbarEnd");
|
||||
write_biff_rec(A, "InterfaceEnd");
|
||||
write_biff_rec(A, "WriteAccess", write_WriteAccess("SheetJS", opts));
|
||||
if(opts.bookType == "xla") write_biff_rec(A, 0x0087 /* Addin */);
|
||||
write_biff_rec(A, 0x00e1 /* InterfaceHdr */, b8 ? writeuint16(0x04b0) : null);
|
||||
write_biff_rec(A, 0x00c1 /* Mms */, writezeroes(2));
|
||||
if(b5) write_biff_rec(A, 0x00bf /* ToolbarHdr */);
|
||||
if(b5) write_biff_rec(A, 0x00c0 /* ToolbarEnd */);
|
||||
write_biff_rec(A, 0x00e2 /* InterfaceEnd */);
|
||||
write_biff_rec(A, 0x005c /* WriteAccess */, write_WriteAccess("SheetJS", opts));
|
||||
/* [FileSharing] */
|
||||
write_biff_rec(A, "CodePage", writeuint16(b8 ? 0x04b0 : 0x04E4));
|
||||
write_biff_rec(A, 0x0042 /* CodePage */, writeuint16(b8 ? 0x04b0 : 0x04E4));
|
||||
/* *2047 Lel */
|
||||
if(b8) write_biff_rec(A, "DSF", writeuint16(0));
|
||||
if(b8) write_biff_rec(A, "Excel9File");
|
||||
write_biff_rec(A, "RRTabId", write_RRTabId(wb.SheetNames.length));
|
||||
if(b8 && wb.vbaraw) write_biff_rec(A, "ObProj");
|
||||
if(b8) write_biff_rec(A, 0x0161 /* DSF */, writeuint16(0));
|
||||
if(b8) write_biff_rec(A, 0x01c0 /* Excel9File */);
|
||||
write_biff_rec(A, 0x013d /* RRTabId */, write_RRTabId(wb.SheetNames.length));
|
||||
if(b8 && wb.vbaraw) write_biff_rec(A, 0x00d3 /* ObProj */);
|
||||
/* [ObNoMacros] */
|
||||
if(b8 && wb.vbaraw) {
|
||||
var cname/*:string*/ = _wb.CodeName || "ThisWorkbook";
|
||||
write_biff_rec(A, "CodeName", write_XLUnicodeString(cname, opts));
|
||||
write_biff_rec(A, 0x01ba /* CodeName */, write_XLUnicodeString(cname, opts));
|
||||
}
|
||||
write_biff_rec(A, "BuiltInFnGroupCount", writeuint16(0x11));
|
||||
write_biff_rec(A, 0x009c /* BuiltInFnGroupCount */, writeuint16(0x11));
|
||||
/* *FnGroupName *FnGrp12 */
|
||||
/* *Lbl */
|
||||
/* [OleObjectSize] */
|
||||
write_biff_rec(A, "WinProtect", writebool(false));
|
||||
write_biff_rec(A, "Protect", writebool(false));
|
||||
write_biff_rec(A, "Password", writeuint16(0));
|
||||
if(b8) write_biff_rec(A, "Prot4Rev", writebool(false));
|
||||
if(b8) write_biff_rec(A, "Prot4RevPass", writeuint16(0));
|
||||
write_biff_rec(A, "Window1", write_Window1(opts));
|
||||
write_biff_rec(A, "Backup", writebool(false));
|
||||
write_biff_rec(A, "HideObj", writeuint16(0));
|
||||
write_biff_rec(A, "Date1904", writebool(safe1904(wb)=="true"));
|
||||
write_biff_rec(A, "CalcPrecision", writebool(true));
|
||||
if(b8) write_biff_rec(A, "RefreshAll", writebool(false));
|
||||
write_biff_rec(A, "BookBool", writeuint16(0));
|
||||
write_biff_rec(A, 0x0019 /* WinProtect */, writebool(false));
|
||||
write_biff_rec(A, 0x0012 /* Protect */, writebool(false));
|
||||
write_biff_rec(A, 0x0013 /* Password */, writeuint16(0));
|
||||
if(b8) write_biff_rec(A, 0x01af /* Prot4Rev */, writebool(false));
|
||||
if(b8) write_biff_rec(A, 0x01bc /* Prot4RevPass */, writeuint16(0));
|
||||
write_biff_rec(A, 0x003d /* Window1 */, write_Window1(opts));
|
||||
write_biff_rec(A, 0x0040 /* Backup */, writebool(false));
|
||||
write_biff_rec(A, 0x008d /* HideObj */, writeuint16(0));
|
||||
write_biff_rec(A, 0x0022 /* Date1904 */, writebool(safe1904(wb)=="true"));
|
||||
write_biff_rec(A, 0x000e /* CalcPrecision */, writebool(true));
|
||||
if(b8) write_biff_rec(A, 0x01b7 /* RefreshAll */, writebool(false));
|
||||
write_biff_rec(A, 0x00DA /* BookBool */, writeuint16(0));
|
||||
/* ... */
|
||||
write_FONTS_biff8(A, wb, opts);
|
||||
write_FMTS_biff8(A, wb.SSF, opts);
|
||||
write_CELLXFS_biff8(A, opts);
|
||||
/* ... */
|
||||
if(b8) write_biff_rec(A, "UsesELFs", writebool(false));
|
||||
if(b8) write_biff_rec(A, 0x0160 /* UsesELFs */, writebool(false));
|
||||
var a = A.end();
|
||||
|
||||
var C = buf_array();
|
||||
/* METADATA [MTRSettings] [ForceFullCalculation] */
|
||||
if(b8) write_biff_rec(C, "Country", write_Country());
|
||||
if(b8) write_biff_rec(C, 0x008C, write_Country());
|
||||
/* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */
|
||||
|
||||
/* BIFF8: [SST *Continue] ExtSST */
|
||||
if(b8 && opts.Strings) write_biff_continue(C, "SST", write_SST(opts.Strings, opts));
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC, write_SST(opts.Strings, opts));
|
||||
|
||||
/* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */
|
||||
write_biff_rec(C, "EOF");
|
||||
write_biff_rec(C, 0x000A /* EOF */);
|
||||
var c = C.end();
|
||||
|
||||
var B = buf_array();
|
||||
@ -339,7 +339,7 @@ function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
|
||||
var start = a.length + blen + c.length;
|
||||
for(j = 0; j < wb.SheetNames.length; ++j) {
|
||||
var _sheet/*:WBWSProp*/ = _sheets[j] || ({}/*:any*/);
|
||||
write_biff_rec(B, "BoundSheet8", write_BoundSheet8({pos:start, hs:_sheet.Hidden||0, dt:0, name:wb.SheetNames[j]}, opts));
|
||||
write_biff_rec(B, 0x0085 /* BoundSheet8 */, write_BoundSheet8({pos:start, hs:_sheet.Hidden||0, dt:0, name:wb.SheetNames[j]}, opts));
|
||||
start += bufs[j].length;
|
||||
}
|
||||
/* 1*BoundSheet8 */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* note: browser DOM element cannot see mso- style attrs, must parse */
|
||||
var HTML_ = (function() {
|
||||
var HTML_ = /*#__PURE__*/(function() {
|
||||
function html_to_sheet(str/*:string*/, _opts)/*:Workbook*/ {
|
||||
var opts = _opts || {};
|
||||
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
|
||||
@ -62,8 +62,8 @@ var HTML_ = (function() {
|
||||
var mtch = str.match(/<table[\s\S]*?>[\s\S]*?<\/table>/gi);
|
||||
if(!mtch || mtch.length == 0) throw new Error("Invalid HTML: could not find <table>");
|
||||
if(mtch.length == 1) return sheet_to_workbook(html_to_sheet(mtch[0], opts), opts);
|
||||
var wb = utils.book_new();
|
||||
mtch.forEach(function(s, idx) { utils.book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx+1)); });
|
||||
var wb = book_new();
|
||||
mtch.forEach(function(s, idx) { book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx+1)); });
|
||||
return wb;
|
||||
}
|
||||
function make_html_row(ws/*:Worksheet*/, r/*:Range*/, R/*:number*/, o/*:Sheet2HTMLOpts*/)/*:string*/ {
|
||||
|
@ -1,35 +1,34 @@
|
||||
/* OpenDocument */
|
||||
var parse_content_xml = (function() {
|
||||
function parse_text_p(text/*:string*//*::, tag*/)/*:Array<any>*/ {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
.replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ")
|
||||
.replace(/<text:s\/>/g," ")
|
||||
.replace(/<text:s text:c="(\d+)"\/>/g, function($$,$1) { return Array(parseInt($1,10)+1).join(" "); })
|
||||
.replace(/<text:tab[^>]*\/>/g,"\t")
|
||||
.replace(/<text:line-break\/>/g,"\n");
|
||||
var v = unescapexml(fixed.replace(/<[^>]*>/g,""));
|
||||
|
||||
var parse_text_p = function(text/*:string*//*::, tag*/)/*:Array<any>*/ {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
.replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ")
|
||||
.replace(/<text:s\/>/g," ")
|
||||
.replace(/<text:s text:c="(\d+)"\/>/g, function($$,$1) { return Array(parseInt($1,10)+1).join(" "); })
|
||||
.replace(/<text:tab[^>]*\/>/g,"\t")
|
||||
.replace(/<text:line-break\/>/g,"\n");
|
||||
var v = unescapexml(fixed.replace(/<[^>]*>/g,""));
|
||||
return [v];
|
||||
}
|
||||
|
||||
return [v];
|
||||
};
|
||||
var number_formats_ods = {
|
||||
/* ods name: [short ssf fmt, long ssf fmt] */
|
||||
day: ["d", "dd"],
|
||||
month: ["m", "mm"],
|
||||
year: ["y", "yy"],
|
||||
hours: ["h", "hh"],
|
||||
minutes: ["m", "mm"],
|
||||
seconds: ["s", "ss"],
|
||||
"am-pm": ["A/P", "AM/PM"],
|
||||
"day-of-week": ["ddd", "dddd"],
|
||||
era: ["e", "ee"],
|
||||
/* there is no native representation of LO "Q" format */
|
||||
quarter: ["\\Qm", "m\\\"th quarter\""]
|
||||
};
|
||||
|
||||
var number_formats = {
|
||||
/* ods name: [short ssf fmt, long ssf fmt] */
|
||||
day: ["d", "dd"],
|
||||
month: ["m", "mm"],
|
||||
year: ["y", "yy"],
|
||||
hours: ["h", "hh"],
|
||||
minutes: ["m", "mm"],
|
||||
seconds: ["s", "ss"],
|
||||
"am-pm": ["A/P", "AM/PM"],
|
||||
"day-of-week": ["ddd", "dddd"],
|
||||
era: ["e", "ee"],
|
||||
/* there is no native representation of LO "Q" format */
|
||||
quarter: ["\\Qm", "m\\\"th quarter\""]
|
||||
};
|
||||
|
||||
return function pcx(d/*:string*/, _opts)/*:Workbook*/ {
|
||||
function parse_content_xml(d/*:string*/, _opts)/*:Workbook*/ {
|
||||
var opts = _opts || {};
|
||||
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
|
||||
var str = xlml_normalize(d);
|
||||
@ -308,7 +307,7 @@ var parse_content_xml = (function() {
|
||||
case 'time-style':
|
||||
case 'date-style':
|
||||
tag = parsexmltag(Rn[0], false);
|
||||
NF += number_formats[Rn[3]][tag.style==='long'?1:0]; break;
|
||||
NF += number_formats_ods[Rn[3]][tag.style==='long'?1:0]; break;
|
||||
} break;
|
||||
|
||||
case 'fraction': break; // TODO 16.27.6 <number:fraction>
|
||||
@ -328,7 +327,7 @@ var parse_content_xml = (function() {
|
||||
case 'time-style':
|
||||
case 'date-style':
|
||||
tag = parsexmltag(Rn[0], false);
|
||||
NF += number_formats[Rn[3]][tag.style==='long'?1:0]; break;
|
||||
NF += number_formats_ods[Rn[3]][tag.style==='long'?1:0]; break;
|
||||
} break;
|
||||
|
||||
case 'boolean-style': break; // 16.27.23 <number:boolean-style>
|
||||
@ -552,8 +551,7 @@ var parse_content_xml = (function() {
|
||||
}/*:any*/);
|
||||
if(opts.bookSheets) delete /*::(*/out/*:: :any)*/.Sheets;
|
||||
return out;
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
function parse_ods(zip/*:ZIPFile*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
opts = opts || ({}/*:any*/);
|
||||
|
@ -1,4 +1,4 @@
|
||||
var NUMBERS = !Object.defineProperty ? (void 0) :/* @__PURE__ */(function() {
|
||||
var NUMBERS = !Object.defineProperty ? (void 0) :(function() {
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
@ -108,7 +108,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
}
|
||||
if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,3 @@
|
||||
function write_obj_str(factory/*:WriteObjStrFactory*/) {
|
||||
return function write_str(wb/*:Workbook*/, o/*:WriteOpts*/)/*:string*/ {
|
||||
var idx = 0;
|
||||
if(o.sheet) {
|
||||
if(typeof o.sheet == "number") idx = o.sheet;
|
||||
else idx = wb.SheetNames.indexOf(o.sheet);
|
||||
if(!wb.SheetNames[idx]) throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet));
|
||||
}
|
||||
return factory.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb);
|
||||
};
|
||||
}
|
||||
|
||||
var write_htm_str = write_obj_str(HTML_);
|
||||
var write_csv_str = write_obj_str({from_sheet:sheet_to_csv});
|
||||
var write_slk_str = write_obj_str(typeof SYLK !== "undefined" ? SYLK : {});
|
||||
var write_dif_str = write_obj_str(typeof DIF !== "undefined" ? DIF : {});
|
||||
var write_prn_str = write_obj_str(typeof PRN !== "undefined" ? PRN : {});
|
||||
var write_rtf_str = write_obj_str(typeof RTF !== "undefined" ? RTF : {});
|
||||
var write_txt_str = write_obj_str({from_sheet:sheet_to_txt});
|
||||
var write_dbf_buf = write_obj_str(typeof DBF !== "undefined" ? DBF : {});
|
||||
var write_eth_str = write_obj_str(typeof ETH !== "undefined" ? ETH : {});
|
||||
var write_wk1_buf = write_obj_str(typeof WK_ !== "undefined" ? {from_sheet:WK_.sheet_to_wk1} : {});
|
||||
|
||||
function write_cfb_ctr(cfb/*:CFBContainer*/, o/*:WriteOpts*/)/*:any*/ {
|
||||
switch(o.type) {
|
||||
case "base64": case "binary": break;
|
||||
@ -138,22 +115,28 @@ function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
var o = dup(opts||{});
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); }
|
||||
var idx = 0;
|
||||
if(o.sheet) {
|
||||
if(typeof o.sheet == "number") idx = o.sheet;
|
||||
else idx = wb.SheetNames.indexOf(o.sheet);
|
||||
if(!wb.SheetNames[idx]) throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet));
|
||||
}
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
case 'xlml': return write_string_type(write_xlml(wb, o), o);
|
||||
case 'slk':
|
||||
case 'sylk': return write_string_type(write_slk_str(wb, o), o);
|
||||
case 'sylk': return write_string_type(SYLK.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'htm':
|
||||
case 'html': return write_string_type(write_htm_str(wb, o), o);
|
||||
case 'txt': return write_stxt_type(write_txt_str(wb, o), o);
|
||||
case 'csv': return write_string_type(write_csv_str(wb, o), o, "\ufeff");
|
||||
case 'dif': return write_string_type(write_dif_str(wb, o), o);
|
||||
case 'dbf': return write_binary_type(write_dbf_buf(wb, o), o);
|
||||
case 'prn': return write_string_type(write_prn_str(wb, o), o);
|
||||
case 'rtf': return write_string_type(write_rtf_str(wb, o), o);
|
||||
case 'eth': return write_string_type(write_eth_str(wb, o), o);
|
||||
case 'html': return write_string_type(HTML_.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'txt': return write_stxt_type(sheet_to_txt(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'csv': return write_string_type(sheet_to_csv(wb.Sheets[wb.SheetNames[idx]], o), o, "\ufeff");
|
||||
case 'dif': return write_string_type(DIF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'dbf': return write_binary_type(DBF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'prn': return write_string_type(PRN.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'rtf': return write_string_type(RTF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'eth': return write_string_type(ETH.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'fods': return write_string_type(write_ods(wb, o), o);
|
||||
case 'wk1': return write_binary_type(write_wk1_buf(wb, o), o);
|
||||
case 'wk1': return write_binary_type(WK_.sheet_to_wk1(wb.Sheets[wb.SheetNames[idx]], o), o);
|
||||
case 'wk3': return write_binary_type(WK_.book_to_wk3(wb, o), o);
|
||||
case 'biff2': if(!o.biff) o.biff = 2; /* falls through */
|
||||
case 'biff3': if(!o.biff) o.biff = 3; /* falls through */
|
||||
|
1
demos/angular2/.gitignore
vendored
1
demos/angular2/.gitignore
vendored
@ -5,3 +5,4 @@ SheetJSNS
|
||||
angular.json
|
||||
tsconfig.app.json
|
||||
src/polyfills.ts
|
||||
.angular
|
||||
|
@ -13,6 +13,7 @@ ng2 ng4 ng5 ng6 ng7 ng8 ng9 ng10 ng11 ng12 ng13:
|
||||
|
||||
.PHONY: refresh
|
||||
refresh: ## refresh the `xlsx` symlink to force angular to rebuild
|
||||
rm -rf .angular/
|
||||
rm -f node_modules/xlsx
|
||||
cd node_modules; ln -s ../../../ xlsx; cd -
|
||||
touch node_modules/xlsx
|
||||
|
31
dist/xlsx.full.min.js
generated
vendored
31
dist/xlsx.full.min.js
generated
vendored
File diff suppressed because one or more lines are too long
@ -40,7 +40,7 @@ type CFBFiles = {[n:string]:CFBEntry};
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported CRC32 */
|
||||
var CRC32 = (function() {
|
||||
var CRC32 = /*#__PURE__*/(function() {
|
||||
var CRC32 = {};
|
||||
CRC32.version = '1.2.0';
|
||||
/* see perf/crc32table.js */
|
||||
@ -132,7 +132,7 @@ CRC32.str = crc32_str;
|
||||
return CRC32;
|
||||
})();
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var CFB = /*#__PURE__*/(function _CFB(){
|
||||
var exports = {};
|
||||
exports.version = '1.2.1';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
@ -1065,7 +1065,7 @@ if(!use_typed_arrays) {
|
||||
for(; i<=279; i++) clens.push(7);
|
||||
for(; i<=287; i++) clens.push(8);
|
||||
build_tree(clens, fix_lmap, 288);
|
||||
})();var _deflateRaw = (function _deflateRawIIFE() {
|
||||
})();var _deflateRaw = /*#__PURE__*/(function _deflateRawIIFE() {
|
||||
var DST_LN_RE = use_typed_arrays ? new Uint8Array(0x8000) : [];
|
||||
var j = 0, k = 0;
|
||||
for(; j < DST_LN.length - 1; ++j) {
|
||||
|
@ -1,10 +1,5 @@
|
||||
RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";
|
||||
|
||||
var CS_XML_ROOT = writextag('chartsheet', null, {
|
||||
'xmlns': XMLNS.main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
});
|
||||
|
||||
/* 18.3 Worksheets also covers Chartsheets */
|
||||
function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ {
|
||||
if(!data) return data;
|
||||
@ -24,7 +19,10 @@ function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, them
|
||||
return s;
|
||||
}
|
||||
function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
var o = [XML_HEADER, CS_XML_ROOT];
|
||||
var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
})];
|
||||
o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
|
@ -220,6 +220,10 @@ import * as XLSX from 'xlsx/xlsx.mjs';
|
||||
import * as fs from 'fs';
|
||||
XLSX.set_fs(fs);
|
||||
|
||||
/* load 'stream' for stream support */
|
||||
import { Readable } from 'stream';
|
||||
XLSX.stream.set_readable(Readable);
|
||||
|
||||
/* load the codepage support library for extended support with older formats */
|
||||
import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs';
|
||||
XLSX.set_cptable(cpexcel);
|
||||
@ -1606,8 +1610,8 @@ The [included demos](demos/) cover mobile apps and other special deployments.
|
||||
### Streaming Write
|
||||
|
||||
The streaming write functions are available in the `XLSX.stream` object. They
|
||||
take the same arguments as the normal write functions but return a Readable
|
||||
Stream. They are only exposed in NodeJS.
|
||||
take the same arguments as the normal write functions but return a NodeJS
|
||||
Readable Stream.
|
||||
|
||||
- `XLSX.stream.to_csv` is the streaming version of `XLSX.utils.sheet_to_csv`.
|
||||
- `XLSX.stream.to_html` is the streaming version of `XLSX.utils.sheet_to_html`.
|
||||
@ -3603,8 +3607,11 @@ takes an options argument:
|
||||
| array of strings | Use specified strings as keys in row objects |
|
||||
| (default) | Read and disambiguate first row as keys |
|
||||
|
||||
If header is not `1`, the row object will contain the non-enumerable property
|
||||
`__rowNum__` that represents the row of the sheet corresponding to the entry.
|
||||
- If header is not `1`, the row object will contain the non-enumerable property
|
||||
`__rowNum__` that represents the row of the sheet corresponding to the entry.
|
||||
- If header is an array, the keys will not be disambiguated. This can lead to
|
||||
unexpected results if the array values are not unique!
|
||||
|
||||
|
||||
|
||||
For the example sheet:
|
||||
|
@ -101,7 +101,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
var opts = _opts || {};
|
||||
var state = [];
|
||||
var pass = false;
|
||||
recordhopper(data, function(val, R_n, RT) {
|
||||
recordhopper(data, function(val, R, RT) {
|
||||
switch (RT) {
|
||||
case 335:
|
||||
out.Types.push({ name: val.name });
|
||||
@ -109,7 +109,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
case 51:
|
||||
break;
|
||||
case 35:
|
||||
state.push(R_n);
|
||||
state.push(RT);
|
||||
pass = true;
|
||||
break;
|
||||
case 36:
|
||||
@ -117,35 +117,34 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
pass = false;
|
||||
break;
|
||||
default:
|
||||
if ((R_n || "").indexOf("Begin") > 0) {
|
||||
} else if ((R_n || "").indexOf("End") > 0) {
|
||||
} else if (!pass || opts.WTF && state[state.length - 1] != "BrtFRTBegin")
|
||||
throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if (R.T) {
|
||||
} else if (!pass || opts.WTF && state[state.length - 1] != 35)
|
||||
throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function write_xlmeta_bin() {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginMetadata");
|
||||
write_record(ba, "BrtBeginEsmdtinfo", write_UInt32LE(1));
|
||||
write_record(ba, "BrtMdtinfo", write_BrtMdtinfo({
|
||||
write_record(ba, 332);
|
||||
write_record(ba, 334, write_UInt32LE(1));
|
||||
write_record(ba, 335, write_BrtMdtinfo({
|
||||
name: "XLDAPR",
|
||||
version: 12e4,
|
||||
flags: 3496657072
|
||||
}));
|
||||
write_record(ba, "BrtEndEsmdtinfo");
|
||||
write_record(ba, "BrtBeginEsfmd", write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, "BrtBeginFmd");
|
||||
write_record(ba, "BrtFRTBegin", write_UInt32LE(514));
|
||||
write_record(ba, "BrtBeginDynamicArrayPr", write_UInt32LE(0));
|
||||
write_record(ba, "BrtEndDynamicArrayPr", writeuint16(1));
|
||||
write_record(ba, "BrtFRTEnd");
|
||||
write_record(ba, "BrtEndFmd");
|
||||
write_record(ba, "BrtEndEsfmd");
|
||||
write_record(ba, "BrtBeginEsmdb", write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, "BrtMdb", write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, "BrtEndEsmdb");
|
||||
write_record(ba, "BrtEndMetadata");
|
||||
write_record(ba, 336);
|
||||
write_record(ba, 339, write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, 52);
|
||||
write_record(ba, 35, write_UInt32LE(514));
|
||||
write_record(ba, 4096, write_UInt32LE(0));
|
||||
write_record(ba, 4097, writeuint16(1));
|
||||
write_record(ba, 36);
|
||||
write_record(ba, 53);
|
||||
write_record(ba, 340);
|
||||
write_record(ba, 337, write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, 51, write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, 338);
|
||||
write_record(ba, 333);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
var opts = _opts || {};
|
||||
var state = [];
|
||||
var pass = false;
|
||||
recordhopper(data, function(val, R_n, RT) {
|
||||
recordhopper(data, function(val, R, RT) {
|
||||
switch (RT) {
|
||||
case 335:
|
||||
out.Types.push({ name: val.name });
|
||||
@ -46,7 +46,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
case 51:
|
||||
break;
|
||||
case 35:
|
||||
state.push(R_n);
|
||||
state.push(RT);
|
||||
pass = true;
|
||||
break;
|
||||
case 36:
|
||||
@ -54,35 +54,34 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
pass = false;
|
||||
break;
|
||||
default:
|
||||
if ((R_n || "").indexOf("Begin") > 0) {
|
||||
} else if ((R_n || "").indexOf("End") > 0) {
|
||||
} else if (!pass || opts.WTF && state[state.length - 1] != "BrtFRTBegin")
|
||||
throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if (R.T) {
|
||||
} else if (!pass || opts.WTF && state[state.length - 1] != 35)
|
||||
throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function write_xlmeta_bin() {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginMetadata");
|
||||
write_record(ba, "BrtBeginEsmdtinfo", write_UInt32LE(1));
|
||||
write_record(ba, "BrtMdtinfo", write_BrtMdtinfo({
|
||||
write_record(ba, 332);
|
||||
write_record(ba, 334, write_UInt32LE(1));
|
||||
write_record(ba, 335, write_BrtMdtinfo({
|
||||
name: "XLDAPR",
|
||||
version: 12e4,
|
||||
flags: 3496657072
|
||||
}));
|
||||
write_record(ba, "BrtEndEsmdtinfo");
|
||||
write_record(ba, "BrtBeginEsfmd", write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, "BrtBeginFmd");
|
||||
write_record(ba, "BrtFRTBegin", write_UInt32LE(514));
|
||||
write_record(ba, "BrtBeginDynamicArrayPr", write_UInt32LE(0));
|
||||
write_record(ba, "BrtEndDynamicArrayPr", writeuint16(1));
|
||||
write_record(ba, "BrtFRTEnd");
|
||||
write_record(ba, "BrtEndFmd");
|
||||
write_record(ba, "BrtEndEsfmd");
|
||||
write_record(ba, "BrtBeginEsmdb", write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, "BrtMdb", write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, "BrtEndEsmdb");
|
||||
write_record(ba, "BrtEndMetadata");
|
||||
write_record(ba, 336);
|
||||
write_record(ba, 339, write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, 52);
|
||||
write_record(ba, 35, write_UInt32LE(514));
|
||||
write_record(ba, 4096, write_UInt32LE(0));
|
||||
write_record(ba, 4097, writeuint16(1));
|
||||
write_record(ba, 36);
|
||||
write_record(ba, 53);
|
||||
write_record(ba, 340);
|
||||
write_record(ba, 337, write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, 51, write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, 338);
|
||||
write_record(ba, 333);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -54,67 +54,66 @@ function write_BrtBeginEsmdb(cnt: number, cm: boolean): RawData {
|
||||
function parse_xlmeta_bin(data, name: string, _opts?: ParseXLMetaOptions): XLMeta {
|
||||
var out: XLMeta = { Types: [] };
|
||||
var opts = _opts || {};
|
||||
var state: string[] = [];
|
||||
var state: number[] = [];
|
||||
var pass = false;
|
||||
|
||||
recordhopper(data, (val, R_n, RT) => {
|
||||
recordhopper(data, (val, R, RT) => {
|
||||
switch(RT) {
|
||||
// case 0x014C: /* 'BrtBeginMetadata' */
|
||||
// case 0x014D: /* 'BrtEndMetadata' */
|
||||
// case 0x014E: /* 'BrtBeginEsmdtinfo' */
|
||||
// case 0x0150: /* 'BrtEndEsmdtinfo' */
|
||||
// case 0x0151: /* 'BrtBeginEsmdb' */
|
||||
// case 0x0152: /* 'BrtEndEsmdb' */
|
||||
// case 0x0153: /* 'BrtBeginEsfmd' */
|
||||
// case 0x0154: /* 'BrtEndEsfmd' */
|
||||
// case 0x0034: /* 'BrtBeginFmd' */
|
||||
// case 0x0035: /* 'BrtEndFmd' */
|
||||
// case 0x1000: /* 'BrtBeginDynamicArrayPr' */
|
||||
// case 0x1001: /* 'BrtEndDynamicArrayPr' */
|
||||
// case 0x138A: /* 'BrtBeginRichValueBlock' */
|
||||
// case 0x138B: /* 'BrtEndRichValueBlock' */
|
||||
// case 0x014C: /* BrtBeginMetadata */
|
||||
// case 0x014D: /* BrtEndMetadata */
|
||||
// case 0x014E: /* BrtBeginEsmdtinfo */
|
||||
// case 0x0150: /* BrtEndEsmdtinfo */
|
||||
// case 0x0151: /* BrtBeginEsmdb */
|
||||
// case 0x0152: /* BrtEndEsmdb */
|
||||
// case 0x0153: /* BrtBeginEsfmd */
|
||||
// case 0x0154: /* BrtEndEsfmd */
|
||||
// case 0x0034: /* BrtBeginFmd */
|
||||
// case 0x0035: /* BrtEndFmd */
|
||||
// case 0x1000: /* BrtBeginDynamicArrayPr */
|
||||
// case 0x1001: /* BrtEndDynamicArrayPr */
|
||||
// case 0x138A: /* BrtBeginRichValueBlock */
|
||||
// case 0x138B: /* BrtEndRichValueBlock */
|
||||
|
||||
case 0x014F: /* 'BrtMdtinfo' */
|
||||
case 0x014F: /* BrtMdtinfo */
|
||||
out.Types.push({name: (val as BrtMdtinfo).name});
|
||||
break;
|
||||
case 0x0033: /* 'BrtMdb' */
|
||||
case 0x0033: /* BrtMdb */
|
||||
break;
|
||||
|
||||
case 0x0023: /* 'BrtFRTBegin' */
|
||||
state.push(R_n); pass = true; break;
|
||||
case 0x0024: /* 'BrtFRTEnd' */
|
||||
case 0x0023: /* BrtFRTBegin */
|
||||
state.push(RT); pass = true; break;
|
||||
case 0x0024: /* BrtFRTEnd */
|
||||
state.pop(); pass = false; break;
|
||||
default:
|
||||
if((R_n||"").indexOf("Begin") > 0){/* empty */}
|
||||
else if((R_n||"").indexOf("End") > 0){/* empty */}
|
||||
else if(!pass || (opts.WTF && state[state.length-1] != "BrtFRTBegin")) throw new Error("Unexpected record " + RT + " " + R_n);
|
||||
if(R.T){/* empty */}
|
||||
else if(!pass || (opts.WTF && state[state.length-1] != 0x0023 /* BrtFRTBegin */)) throw new Error("Unexpected record 0x" + RT.toString(16));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function write_xlmeta_bin() {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginMetadata");
|
||||
write_record(ba, "BrtBeginEsmdtinfo", write_UInt32LE(1));
|
||||
write_record(ba, "BrtMdtinfo", write_BrtMdtinfo({
|
||||
write_record(ba, 0x014C /* BrtBeginMetadata */);
|
||||
write_record(ba, 0x014E /* BrtBeginEsmdtinfo */, write_UInt32LE(1));
|
||||
write_record(ba, 0x014F /* BrtMdtinfo */, write_BrtMdtinfo({
|
||||
name: "XLDAPR",
|
||||
version: 120000,
|
||||
flags: 0xD06AC0B0
|
||||
}));
|
||||
write_record(ba, "BrtEndEsmdtinfo");
|
||||
write_record(ba, 0x0150 /* BrtEndEsmdtinfo */);
|
||||
/* [ESSTR] [ESMDX] */
|
||||
write_record(ba, "BrtBeginEsfmd", write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, "BrtBeginFmd");
|
||||
write_record(ba, "BrtFRTBegin", write_UInt32LE(0x0202));
|
||||
write_record(ba, "BrtBeginDynamicArrayPr", write_UInt32LE(0));
|
||||
write_record(ba, "BrtEndDynamicArrayPr", writeuint16(1));
|
||||
write_record(ba, "BrtFRTEnd");
|
||||
write_record(ba, "BrtEndFmd");
|
||||
write_record(ba, "BrtEndEsfmd");
|
||||
write_record(ba, "BrtBeginEsmdb", write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, "BrtMdb", write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, "BrtEndEsmdb");
|
||||
write_record(ba, 0x0153 /* BrtBeginEsfmd */, write_BrtBeginEsfmd(1, "XLDAPR"));
|
||||
write_record(ba, 0x0034 /* BrtBeginFmd */);
|
||||
write_record(ba, 0x0023 /* BrtFRTBegin */, write_UInt32LE(0x0202));
|
||||
write_record(ba, 0x1000 /* BrtBeginDynamicArrayPr */, write_UInt32LE(0));
|
||||
write_record(ba, 0x1001 /* BrtEndDynamicArrayPr */, writeuint16(1));
|
||||
write_record(ba, 0x0024 /* BrtFRTEnd */);
|
||||
write_record(ba, 0x0035 /* BrtEndFmd */);
|
||||
write_record(ba, 0x0154 /* BrtEndEsfmd */);
|
||||
write_record(ba, 0x0151 /* BrtBeginEsmdb */, write_BrtBeginEsmdb(1, true));
|
||||
write_record(ba, 0x0033 /* BrtMdb */, write_BrtMdb([[1, 0]]));
|
||||
write_record(ba, 0x0152 /* BrtEndEsmdb */);
|
||||
/* *FRT */
|
||||
write_record(ba, "BrtEndMetadata");
|
||||
write_record(ba, 0x014D /* BrtEndMetadata */);
|
||||
return ba.end();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ interface BufArray {
|
||||
push(buf: RawData): void;
|
||||
}
|
||||
declare function buf_array(): BufArray;
|
||||
declare function write_record(ba: BufArray, type: string, payload?: RawData, length?: number): void;
|
||||
declare function write_record(ba: BufArray, type: number, payload?: RawData, length?: number): void;
|
||||
declare function new_buf(sz: number): RawData & WritableData & ReadableData;
|
||||
|
||||
declare var tagregex: RegExp;
|
||||
|
@ -3,4 +3,4 @@
|
||||
/*jshint -W041 */
|
||||
/*:: declare var DO_NOT_EXPORT_SSF: any; */
|
||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||
function make_ssf(SSF/*:SSFModule*/){
|
||||
|
@ -1,4 +1,4 @@
|
||||
};
|
||||
}
|
||||
make_ssf(SSF);
|
||||
/*global module */
|
||||
if(typeof module !== 'undefined' && typeof DO_NOT_EXPORT_SSF === 'undefined') module.exports = SSF;
|
||||
|
4295
xlsx.flow.js
4295
xlsx.flow.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user