XLML case insensitive (fixes #1800)

h/t @panraj01, many tags are case insensitive
This commit is contained in:
SheetJS 2020-03-18 02:47:02 -04:00
parent 0a57229d3b
commit c91d2187e6
3 changed files with 1173 additions and 1143 deletions

View File

@ -108,7 +108,7 @@ function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, a
break;
case 'String':
cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml));
cell.v = xml.indexOf("<") > -1 ? unescapexml(ss||xml) : cell.r;
cell.v = (xml.indexOf("<") > -1 ? unescapexml(ss||xml).replace(/<.*?>/g, "") : cell.r); // todo: BR etc
break;
case 'DateTime':
if(xml.slice(-1) != "Z") xml += "Z";
@ -204,13 +204,19 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false} }/*:any*/), wsprops = {};
xlmlregex.lastIndex = 0;
str = str.replace(/<!--([\s\S]*?)-->/mg,"");
while((Rn = xlmlregex.exec(str))) switch(Rn[3]) {
case 'Data':
var raw_Rn3 = "";
while((Rn = xlmlregex.exec(str))) switch((Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase())) {
case 'data' /*case 'Data'*/:
if(raw_Rn3 == "data") {
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
break;
}
if(state[state.length-1][1]) break;
if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]=="Comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts);
if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]==/*"Comment"*/"comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts);
else { ss = ""; dtag = xlml_parsexmltag(Rn[0]); didx = Rn.index + Rn[0].length; }
break;
case 'Cell':
case 'cell' /*case 'Cell'*/:
if(Rn[1]==='/'){
if(comments.length > 0) cell.c = comments;
if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== undefined) {
@ -254,7 +260,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
comments = [];
}
break;
case 'Row':
case 'row' /*case 'Row'*/:
if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") {
if(r < refguess.s.r) refguess.s.r = r;
if(r > refguess.e.r) refguess.e.r = r;
@ -274,7 +280,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; }
}
break;
case 'Worksheet': /* TODO: read range from FullRows/FullColumns */
case 'worksheet' /*case 'Worksheet'*/: /* TODO: read range from FullRows/FullColumns */
if(Rn[1]==='/'){
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
sheetnames.push(sheetname);
@ -304,7 +310,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
Workbook.Sheets.push(wsprops);
}
break;
case 'Table':
case 'table' /*case 'Table'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].slice(-2) == "/>") break;
else {
@ -314,20 +320,20 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'Style':
case 'style' /*case 'Style'*/:
if(Rn[1]==='/') process_style_xlml(styles, stag, opts);
else stag = xlml_parsexmltag(Rn[0]);
break;
case 'NumberFormat':
case 'numberformat' /*case 'NumberFormat'*/:
stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General");
if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf];
for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == stag.nf) break;
if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == null) { SSF.load(stag.nf, ssfidx); break; }
break;
case 'Column':
if(state[state.length-1][0] !== 'Table') break;
case 'column' /*case 'Column'*/:
if(state[state.length-1][0] !== /*'Table'*/'table') break;
csty = xlml_parsexmltag(Rn[0]);
if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; }
if(csty.Width) csty.wpx = parseInt(csty.Width, 10);
@ -340,7 +346,8 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
for(var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty);
break;
case 'NamedRange':
case 'namedrange' /*case 'NamedRange'*/:
if(Rn[1]==='/') break;
if(!Workbook.Names) Workbook.Names = [];
var _NamedRange = parsexmltag(Rn[0]);
var _DefinedName/*:DefinedName*/ = ({
@ -351,62 +358,65 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
/*:: if(Workbook.Names) */Workbook.Names.push(_DefinedName);
break;
case 'NamedCell': break;
case 'B': break;
case 'I': break;
case 'U': break;
case 'S': break;
case 'Sub': break;
case 'Sup': break;
case 'Span': break;
case 'Alignment':
case 'namedcell' /*case 'NamedCell'*/: break;
case 'b' /*case 'B'*/: break;
case 'i' /*case 'I'*/: break;
case 'u' /*case 'U'*/: break;
case 's' /*case 'S'*/: break;
case 'em' /*case 'EM'*/: break;
case 'h2' /*case 'H2'*/: break;
case 'h3' /*case 'H3'*/: break;
case 'sub' /*case 'Sub'*/: break;
case 'sup' /*case 'Sup'*/: break;
case 'span' /*case 'Span'*/: break;
case 'alignment' /*case 'Alignment'*/:
break;
case 'Borders': break;
case 'Border': break;
case 'Font':
case 'borders' /*case 'Borders'*/: break;
case 'border' /*case 'Border'*/: break;
case 'font' /*case 'Font'*/:
if(Rn[0].slice(-2) === "/>") break;
else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index);
else fidx = Rn.index + Rn[0].length;
break;
case 'Interior':
case 'interior' /*case 'Interior'*/:
if(!opts.cellStyles) break;
stag.Interior = xlml_parsexmltag(Rn[0]);
break;
case 'Protection': break;
case 'protection' /*case 'Protection'*/: break;
case 'Author':
case 'Title':
case 'Description':
case 'Created':
case 'Keywords':
case 'Subject':
case 'Category':
case 'Company':
case 'LastAuthor':
case 'LastSaved':
case 'LastPrinted':
case 'Version':
case 'Revision':
case 'TotalTime':
case 'HyperlinkBase':
case 'Manager':
case 'ContentStatus':
case 'Identifier':
case 'Language':
case 'AppName':
case 'author' /*case 'Author'*/:
case 'title' /*case 'Title'*/:
case 'description' /*case 'Description'*/:
case 'created' /*case 'Created'*/:
case 'keywords' /*case 'Keywords'*/:
case 'subject' /*case 'Subject'*/:
case 'category' /*case 'Category'*/:
case 'company' /*case 'Company'*/:
case 'lastauthor' /*case 'LastAuthor'*/:
case 'lastsaved' /*case 'LastSaved'*/:
case 'lastprinted' /*case 'LastPrinted'*/:
case 'version' /*case 'Version'*/:
case 'revision' /*case 'Revision'*/:
case 'totaltime' /*case 'TotalTime'*/:
case 'hyperlinkbase' /*case 'HyperlinkBase'*/:
case 'manager' /*case 'Manager'*/:
case 'contentstatus' /*case 'ContentStatus'*/:
case 'identifier' /*case 'Identifier'*/:
case 'language' /*case 'Language'*/:
case 'appname' /*case 'AppName'*/:
if(Rn[0].slice(-2) === "/>") break;
else if(Rn[1]==="/") xlml_set_prop(Props, Rn[3], str.slice(pidx, Rn.index));
else if(Rn[1]==="/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index));
else pidx = Rn.index + Rn[0].length;
break;
case 'Paragraphs': break;
case 'paragraphs' /*case 'Paragraphs'*/: break;
case 'Styles':
case 'Workbook':
case 'styles' /*case 'Styles'*/:
case 'workbook' /*case 'Workbook'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else state.push([Rn[3], false]);
break;
case 'Comment':
case 'comment' /*case 'Comment'*/:
if(Rn[1]==='/'){
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
xlml_clean_comment(comment);
@ -418,7 +428,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'AutoFilter':
case 'autofilter' /*case 'AutoFilter'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
var AutoFilter = xlml_parsexmltag(Rn[0]);
@ -427,9 +437,9 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'Name': break;
case 'name' /*case 'Name'*/: break;
case 'DataValidation':
case 'datavalidation' /*case 'DataValidation'*/:
if(Rn[1]==='/'){
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
} else {
@ -437,25 +447,26 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'ComponentOptions':
case 'DocumentProperties':
case 'CustomDocumentProperties':
case 'OfficeDocumentSettings':
case 'PivotTable':
case 'PivotCache':
case 'Names':
case 'MapInfo':
case 'PageBreaks':
case 'QueryTable':
case 'Sorting':
case 'Schema':
case 'data':
case 'ConditionalFormatting':
case 'SmartTagType':
case 'SmartTags':
case 'ExcelWorkbook':
case 'WorkbookOptions':
case 'WorksheetOptions':
case 'pixelsperinch' /*case 'PixelsPerInch'*/:
break;
case 'componentoptions' /*case 'ComponentOptions'*/:
case 'documentproperties' /*case 'DocumentProperties'*/:
case 'customdocumentproperties' /*case 'CustomDocumentProperties'*/:
case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/:
case 'pivottable' /*case 'PivotTable'*/:
case 'pivotcache' /*case 'PivotCache'*/:
case 'names' /*case 'Names'*/:
case 'mapinfo' /*case 'MapInfo'*/:
case 'pagebreaks' /*case 'PageBreaks'*/:
case 'querytable' /*case 'QueryTable'*/:
case 'sorting' /*case 'Sorting'*/:
case 'schema' /*case 'Schema'*/: //case 'data' /*case 'data'*/:
case 'conditionalformatting' /*case 'ConditionalFormatting'*/:
case 'smarttagtype' /*case 'SmartTagType'*/:
case 'smarttags' /*case 'SmartTags'*/:
case 'excelworkbook' /*case 'ExcelWorkbook'*/:
case 'workbookoptions' /*case 'WorkbookOptions'*/:
case 'worksheetoptions' /*case 'WorksheetOptions'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
break;
@ -464,104 +475,103 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
/* FODS file root is <office:document> */
if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts);
/* UOS file root is <uof:UOF> */
if(state.length == 0 && Rn[3] == "UOF") return parse_fods(str, opts);
if(state.length == 0 && Rn[3] == "uof"/*"UOF"*/) return parse_fods(str, opts);
var seen = true;
switch(state[state.length-1][0]) {
/* OfficeDocumentSettings */
case 'OfficeDocumentSettings': switch(Rn[3]) {
case 'AllowPNG': break;
case 'RemovePersonalInformation': break;
case 'DownloadComponents': break;
case 'LocationOfComponents': break;
case 'Colors': break;
case 'Color': break;
case 'Index': break;
case 'RGB': break;
case 'PixelsPerInch': break; // TODO: set PPI
case 'TargetScreenSize': break;
case 'ReadOnlyRecommended': break;
case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: switch(Rn[3]) {
case 'allowpng' /*case 'AllowPNG'*/: break;
case 'removepersonalinformation' /*case 'RemovePersonalInformation'*/: break;
case 'downloadcomponents' /*case 'DownloadComponents'*/: break;
case 'locationofcomponents' /*case 'LocationOfComponents'*/: break;
case 'colors' /*case 'Colors'*/: break;
case 'color' /*case 'Color'*/: break;
case 'index' /*case 'Index'*/: break;
case 'rgb' /*case 'RGB'*/: break;
case 'targetscreensize' /*case 'TargetScreenSize'*/: break;
case 'readonlyrecommended' /*case 'ReadOnlyRecommended'*/: break;
default: seen = false;
} break;
/* ComponentOptions */
case 'ComponentOptions': switch(Rn[3]) {
case 'Toolbar': break;
case 'HideOfficeLogo': break;
case 'SpreadsheetAutoFit': break;
case 'Label': break;
case 'Caption': break;
case 'MaxHeight': break;
case 'MaxWidth': break;
case 'NextSheetNumber': break;
case 'componentoptions' /*case 'ComponentOptions'*/: switch(Rn[3]) {
case 'toolbar' /*case 'Toolbar'*/: break;
case 'hideofficelogo' /*case 'HideOfficeLogo'*/: break;
case 'spreadsheetautofit' /*case 'SpreadsheetAutoFit'*/: break;
case 'label' /*case 'Label'*/: break;
case 'caption' /*case 'Caption'*/: break;
case 'maxheight' /*case 'MaxHeight'*/: break;
case 'maxwidth' /*case 'MaxWidth'*/: break;
case 'nextsheetnumber' /*case 'NextSheetNumber'*/: break;
default: seen = false;
} break;
/* ExcelWorkbook */
case 'ExcelWorkbook': switch(Rn[3]) {
case 'Date1904':
case 'excelworkbook' /*case 'ExcelWorkbook'*/: switch(Rn[3]) {
case 'date1904' /*case 'Date1904'*/:
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
Workbook.WBProps.date1904 = true;
break;
case 'WindowHeight': break;
case 'WindowWidth': break;
case 'WindowTopX': break;
case 'WindowTopY': break;
case 'TabRatio': break;
case 'ProtectStructure': break;
case 'ProtectWindow': break;
case 'ProtectWindows': break;
case 'ActiveSheet': break;
case 'DisplayInkNotes': break;
case 'FirstVisibleSheet': break;
case 'SupBook': break;
case 'SheetName': break;
case 'SheetIndex': break;
case 'SheetIndexFirst': break;
case 'SheetIndexLast': break;
case 'Dll': break;
case 'AcceptLabelsInFormulas': break;
case 'DoNotSaveLinkValues': break;
case 'Iteration': break;
case 'MaxIterations': break;
case 'MaxChange': break;
case 'Path': break;
case 'Xct': break;
case 'Count': break;
case 'SelectedSheets': break;
case 'Calculation': break;
case 'Uncalced': break;
case 'StartupPrompt': break;
case 'Crn': break;
case 'ExternName': break;
case 'Formula': break;
case 'ColFirst': break;
case 'ColLast': break;
case 'WantAdvise': break;
case 'Boolean': break;
case 'Error': break;
case 'Text': break;
case 'OLE': break;
case 'NoAutoRecover': break;
case 'PublishObjects': break;
case 'DoNotCalculateBeforeSave': break;
case 'Number': break;
case 'RefModeR1C1': break;
case 'EmbedSaveSmartTags': break;
case 'windowheight' /*case 'WindowHeight'*/: break;
case 'windowwidth' /*case 'WindowWidth'*/: break;
case 'windowtopx' /*case 'WindowTopX'*/: break;
case 'windowtopy' /*case 'WindowTopY'*/: break;
case 'tabratio' /*case 'TabRatio'*/: break;
case 'protectstructure' /*case 'ProtectStructure'*/: break;
case 'protectwindow' /*case 'ProtectWindow'*/: break;
case 'protectwindows' /*case 'ProtectWindows'*/: break;
case 'activesheet' /*case 'ActiveSheet'*/: break;
case 'displayinknotes' /*case 'DisplayInkNotes'*/: break;
case 'firstvisiblesheet' /*case 'FirstVisibleSheet'*/: break;
case 'supbook' /*case 'SupBook'*/: break;
case 'sheetname' /*case 'SheetName'*/: break;
case 'sheetindex' /*case 'SheetIndex'*/: break;
case 'sheetindexfirst' /*case 'SheetIndexFirst'*/: break;
case 'sheetindexlast' /*case 'SheetIndexLast'*/: break;
case 'dll' /*case 'Dll'*/: break;
case 'acceptlabelsinformulas' /*case 'AcceptLabelsInFormulas'*/: break;
case 'donotsavelinkvalues' /*case 'DoNotSaveLinkValues'*/: break;
case 'iteration' /*case 'Iteration'*/: break;
case 'maxiterations' /*case 'MaxIterations'*/: break;
case 'maxchange' /*case 'MaxChange'*/: break;
case 'path' /*case 'Path'*/: break;
case 'xct' /*case 'Xct'*/: break;
case 'count' /*case 'Count'*/: break;
case 'selectedsheets' /*case 'SelectedSheets'*/: break;
case 'calculation' /*case 'Calculation'*/: break;
case 'uncalced' /*case 'Uncalced'*/: break;
case 'startupprompt' /*case 'StartupPrompt'*/: break;
case 'crn' /*case 'Crn'*/: break;
case 'externname' /*case 'ExternName'*/: break;
case 'formula' /*case 'Formula'*/: break;
case 'colfirst' /*case 'ColFirst'*/: break;
case 'collast' /*case 'ColLast'*/: break;
case 'wantadvise' /*case 'WantAdvise'*/: break;
case 'boolean' /*case 'Boolean'*/: break;
case 'error' /*case 'Error'*/: break;
case 'text' /*case 'Text'*/: break;
case 'ole' /*case 'OLE'*/: break;
case 'noautorecover' /*case 'NoAutoRecover'*/: break;
case 'publishobjects' /*case 'PublishObjects'*/: break;
case 'donotcalculatebeforesave' /*case 'DoNotCalculateBeforeSave'*/: break;
case 'number' /*case 'Number'*/: break;
case 'refmoder1c1' /*case 'RefModeR1C1'*/: break;
case 'embedsavesmarttags' /*case 'EmbedSaveSmartTags'*/: break;
default: seen = false;
} break;
/* WorkbookOptions */
case 'WorkbookOptions': switch(Rn[3]) {
case 'OWCVersion': break;
case 'Height': break;
case 'Width': break;
case 'workbookoptions' /*case 'WorkbookOptions'*/: switch(Rn[3]) {
case 'owcversion' /*case 'OWCVersion'*/: break;
case 'height' /*case 'Height'*/: break;
case 'width' /*case 'Width'*/: break;
default: seen = false;
} break;
/* WorksheetOptions */
case 'WorksheetOptions': switch(Rn[3]) {
case 'Visible':
case 'worksheetoptions' /*case 'WorksheetOptions'*/: switch(Rn[3]) {
case 'visible' /*case 'Visible'*/:
if(Rn[0].slice(-2) === "/>"){/* empty */}
else if(Rn[1]==="/") switch(str.slice(pidx, Rn.index)) {
case "SheetHidden": wsprops.Hidden = 1; break;
@ -569,15 +579,15 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
else pidx = Rn.index + Rn[0].length;
break;
case 'Header':
case 'header' /*case 'Header'*/:
if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml');
cursheet['!margins'].header = parsexmltag(Rn[0]).Margin;
break;
case 'Footer':
case 'footer' /*case 'Footer'*/:
if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml');
cursheet['!margins'].footer = parsexmltag(Rn[0]).Margin;
break;
case 'PageMargins':
case 'pagemargins' /*case 'PageMargins'*/:
var pagemargins = parsexmltag(Rn[0]);
if(!cursheet['!margins']) default_margins(cursheet['!margins']={},'xlml');
if(pagemargins.Top) cursheet['!margins'].top = pagemargins.Top;
@ -585,280 +595,280 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
if(pagemargins.Right) cursheet['!margins'].right = pagemargins.Right;
if(pagemargins.Bottom) cursheet['!margins'].bottom = pagemargins.Bottom;
break;
case 'DisplayRightToLeft':
case 'displayrighttoleft' /*case 'DisplayRightToLeft'*/:
if(!Workbook.Views) Workbook.Views = [];
if(!Workbook.Views[0]) Workbook.Views[0] = {};
Workbook.Views[0].RTL = true;
break;
case 'FreezePanes': break;
case 'FrozenNoSplit': break;
case 'freezepanes' /*case 'FreezePanes'*/: break;
case 'frozennosplit' /*case 'FrozenNoSplit'*/: break;
case 'SplitHorizontal':
case 'SplitVertical':
case 'splithorizontal' /*case 'SplitHorizontal'*/:
case 'splitvertical' /*case 'SplitVertical'*/:
break;
case 'DoNotDisplayGridlines':
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
break;
case 'TopRowBottomPane': break;
case 'LeftColumnRightPane': break;
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
case 'Unsynced': break;
case 'Print': break;
case 'Panes': break;
case 'Scale': break;
case 'Pane': break;
case 'Number': break;
case 'Layout': break;
case 'PageSetup': break;
case 'Selected': break;
case 'ProtectObjects': break;
case 'EnableSelection': break;
case 'ProtectScenarios': break;
case 'ValidPrinterInfo': break;
case 'HorizontalResolution': break;
case 'VerticalResolution': break;
case 'NumberofCopies': break;
case 'ActiveRow': break;
case 'ActiveCol': break;
case 'ActivePane': break;
case 'TopRowVisible': break;
case 'LeftColumnVisible': break;
case 'FitToPage': break;
case 'RangeSelection': break;
case 'PaperSizeIndex': break;
case 'PageLayoutZoom': break;
case 'PageBreakZoom': break;
case 'FilterOn': break;
case 'FitWidth': break;
case 'FitHeight': break;
case 'CommentsLayout': break;
case 'Zoom': break;
case 'LeftToRight': break;
case 'Gridlines': break;
case 'AllowSort': break;
case 'AllowFilter': break;
case 'AllowInsertRows': break;
case 'AllowDeleteRows': break;
case 'AllowInsertCols': break;
case 'AllowDeleteCols': break;
case 'AllowInsertHyperlinks': break;
case 'AllowFormatCells': break;
case 'AllowSizeCols': break;
case 'AllowSizeRows': break;
case 'NoSummaryRowsBelowDetail': break;
case 'TabColorIndex': break;
case 'DoNotDisplayHeadings': break;
case 'ShowPageLayoutZoom': break;
case 'NoSummaryColumnsRightDetail': break;
case 'BlackAndWhite': break;
case 'DoNotDisplayZeros': break;
case 'DisplayPageBreak': break;
case 'RowColHeadings': break;
case 'DoNotDisplayOutline': break;
case 'NoOrientation': break;
case 'AllowUsePivotTables': break;
case 'ZeroHeight': break;
case 'ViewableRange': break;
case 'Selection': break;
case 'ProtectContents': break;
case 'unsynced' /*case 'Unsynced'*/: break;
case 'print' /*case 'Print'*/: break;
case 'panes' /*case 'Panes'*/: break;
case 'scale' /*case 'Scale'*/: break;
case 'pane' /*case 'Pane'*/: break;
case 'number' /*case 'Number'*/: break;
case 'layout' /*case 'Layout'*/: break;
case 'pagesetup' /*case 'PageSetup'*/: break;
case 'selected' /*case 'Selected'*/: break;
case 'protectobjects' /*case 'ProtectObjects'*/: break;
case 'enableselection' /*case 'EnableSelection'*/: break;
case 'protectscenarios' /*case 'ProtectScenarios'*/: break;
case 'validprinterinfo' /*case 'ValidPrinterInfo'*/: break;
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'activepane' /*case 'ActivePane'*/: break;
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;
case 'fittopage' /*case 'FitToPage'*/: break;
case 'rangeselection' /*case 'RangeSelection'*/: break;
case 'papersizeindex' /*case 'PaperSizeIndex'*/: break;
case 'pagelayoutzoom' /*case 'PageLayoutZoom'*/: break;
case 'pagebreakzoom' /*case 'PageBreakZoom'*/: break;
case 'filteron' /*case 'FilterOn'*/: break;
case 'fitwidth' /*case 'FitWidth'*/: break;
case 'fitheight' /*case 'FitHeight'*/: break;
case 'commentslayout' /*case 'CommentsLayout'*/: break;
case 'zoom' /*case 'Zoom'*/: break;
case 'lefttoright' /*case 'LeftToRight'*/: break;
case 'gridlines' /*case 'Gridlines'*/: break;
case 'allowsort' /*case 'AllowSort'*/: break;
case 'allowfilter' /*case 'AllowFilter'*/: break;
case 'allowinsertrows' /*case 'AllowInsertRows'*/: break;
case 'allowdeleterows' /*case 'AllowDeleteRows'*/: break;
case 'allowinsertcols' /*case 'AllowInsertCols'*/: break;
case 'allowdeletecols' /*case 'AllowDeleteCols'*/: break;
case 'allowinserthyperlinks' /*case 'AllowInsertHyperlinks'*/: break;
case 'allowformatcells' /*case 'AllowFormatCells'*/: break;
case 'allowsizecols' /*case 'AllowSizeCols'*/: break;
case 'allowsizerows' /*case 'AllowSizeRows'*/: break;
case 'nosummaryrowsbelowdetail' /*case 'NoSummaryRowsBelowDetail'*/: break;
case 'tabcolorindex' /*case 'TabColorIndex'*/: break;
case 'donotdisplayheadings' /*case 'DoNotDisplayHeadings'*/: break;
case 'showpagelayoutzoom' /*case 'ShowPageLayoutZoom'*/: break;
case 'nosummarycolumnsrightdetail' /*case 'NoSummaryColumnsRightDetail'*/: break;
case 'blackandwhite' /*case 'BlackAndWhite'*/: break;
case 'donotdisplayzeros' /*case 'DoNotDisplayZeros'*/: break;
case 'displaypagebreak' /*case 'DisplayPageBreak'*/: break;
case 'rowcolheadings' /*case 'RowColHeadings'*/: break;
case 'donotdisplayoutline' /*case 'DoNotDisplayOutline'*/: break;
case 'noorientation' /*case 'NoOrientation'*/: break;
case 'allowusepivottables' /*case 'AllowUsePivotTables'*/: break;
case 'zeroheight' /*case 'ZeroHeight'*/: break;
case 'viewablerange' /*case 'ViewableRange'*/: break;
case 'selection' /*case 'Selection'*/: break;
case 'protectcontents' /*case 'ProtectContents'*/: break;
default: seen = false;
} break;
/* PivotTable */
case 'PivotTable': case 'PivotCache': switch(Rn[3]) {
case 'ImmediateItemsOnDrop': break;
case 'ShowPageMultipleItemLabel': break;
case 'CompactRowIndent': break;
case 'Location': break;
case 'PivotField': break;
case 'Orientation': break;
case 'LayoutForm': break;
case 'LayoutSubtotalLocation': break;
case 'LayoutCompactRow': break;
case 'Position': break;
case 'PivotItem': break;
case 'DataType': break;
case 'DataField': break;
case 'SourceName': break;
case 'ParentField': break;
case 'PTLineItems': break;
case 'PTLineItem': break;
case 'CountOfSameItems': break;
case 'Item': break;
case 'ItemType': break;
case 'PTSource': break;
case 'CacheIndex': break;
case 'ConsolidationReference': break;
case 'FileName': break;
case 'Reference': break;
case 'NoColumnGrand': break;
case 'NoRowGrand': break;
case 'BlankLineAfterItems': break;
case 'Hidden': break;
case 'Subtotal': break;
case 'BaseField': break;
case 'MapChildItems': break;
case 'Function': break;
case 'RefreshOnFileOpen': break;
case 'PrintSetTitles': break;
case 'MergeLabels': break;
case 'DefaultVersion': break;
case 'RefreshName': break;
case 'RefreshDate': break;
case 'RefreshDateCopy': break;
case 'VersionLastRefresh': break;
case 'VersionLastUpdate': break;
case 'VersionUpdateableMin': break;
case 'VersionRefreshableMin': break;
case 'Calculation': break;
case 'pivottable' /*case 'PivotTable'*/: case 'pivotcache' /*case 'PivotCache'*/: switch(Rn[3]) {
case 'immediateitemsondrop' /*case 'ImmediateItemsOnDrop'*/: break;
case 'showpagemultipleitemlabel' /*case 'ShowPageMultipleItemLabel'*/: break;
case 'compactrowindent' /*case 'CompactRowIndent'*/: break;
case 'location' /*case 'Location'*/: break;
case 'pivotfield' /*case 'PivotField'*/: break;
case 'orientation' /*case 'Orientation'*/: break;
case 'layoutform' /*case 'LayoutForm'*/: break;
case 'layoutsubtotallocation' /*case 'LayoutSubtotalLocation'*/: break;
case 'layoutcompactrow' /*case 'LayoutCompactRow'*/: break;
case 'position' /*case 'Position'*/: break;
case 'pivotitem' /*case 'PivotItem'*/: break;
case 'datatype' /*case 'DataType'*/: break;
case 'datafield' /*case 'DataField'*/: break;
case 'sourcename' /*case 'SourceName'*/: break;
case 'parentfield' /*case 'ParentField'*/: break;
case 'ptlineitems' /*case 'PTLineItems'*/: break;
case 'ptlineitem' /*case 'PTLineItem'*/: break;
case 'countofsameitems' /*case 'CountOfSameItems'*/: break;
case 'item' /*case 'Item'*/: break;
case 'itemtype' /*case 'ItemType'*/: break;
case 'ptsource' /*case 'PTSource'*/: break;
case 'cacheindex' /*case 'CacheIndex'*/: break;
case 'consolidationreference' /*case 'ConsolidationReference'*/: break;
case 'filename' /*case 'FileName'*/: break;
case 'reference' /*case 'Reference'*/: break;
case 'nocolumngrand' /*case 'NoColumnGrand'*/: break;
case 'norowgrand' /*case 'NoRowGrand'*/: break;
case 'blanklineafteritems' /*case 'BlankLineAfterItems'*/: break;
case 'hidden' /*case 'Hidden'*/: break;
case 'subtotal' /*case 'Subtotal'*/: break;
case 'basefield' /*case 'BaseField'*/: break;
case 'mapchilditems' /*case 'MapChildItems'*/: break;
case 'function' /*case 'Function'*/: break;
case 'refreshonfileopen' /*case 'RefreshOnFileOpen'*/: break;
case 'printsettitles' /*case 'PrintSetTitles'*/: break;
case 'mergelabels' /*case 'MergeLabels'*/: break;
case 'defaultversion' /*case 'DefaultVersion'*/: break;
case 'refreshname' /*case 'RefreshName'*/: break;
case 'refreshdate' /*case 'RefreshDate'*/: break;
case 'refreshdatecopy' /*case 'RefreshDateCopy'*/: break;
case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break;
case 'versionlastupdate' /*case 'VersionLastUpdate'*/: break;
case 'versionupdateablemin' /*case 'VersionUpdateableMin'*/: break;
case 'versionrefreshablemin' /*case 'VersionRefreshableMin'*/: break;
case 'calculation' /*case 'Calculation'*/: break;
default: seen = false;
} break;
/* PageBreaks */
case 'PageBreaks': switch(Rn[3]) {
case 'ColBreaks': break;
case 'ColBreak': break;
case 'RowBreaks': break;
case 'RowBreak': break;
case 'ColStart': break;
case 'ColEnd': break;
case 'RowEnd': break;
case 'pagebreaks' /*case 'PageBreaks'*/: switch(Rn[3]) {
case 'colbreaks' /*case 'ColBreaks'*/: break;
case 'colbreak' /*case 'ColBreak'*/: break;
case 'rowbreaks' /*case 'RowBreaks'*/: break;
case 'rowbreak' /*case 'RowBreak'*/: break;
case 'colstart' /*case 'ColStart'*/: break;
case 'colend' /*case 'ColEnd'*/: break;
case 'rowend' /*case 'RowEnd'*/: break;
default: seen = false;
} break;
/* AutoFilter */
case 'AutoFilter': switch(Rn[3]) {
case 'AutoFilterColumn': break;
case 'AutoFilterCondition': break;
case 'AutoFilterAnd': break;
case 'AutoFilterOr': break;
case 'autofilter' /*case 'AutoFilter'*/: switch(Rn[3]) {
case 'autofiltercolumn' /*case 'AutoFilterColumn'*/: break;
case 'autofiltercondition' /*case 'AutoFilterCondition'*/: break;
case 'autofilterand' /*case 'AutoFilterAnd'*/: break;
case 'autofilteror' /*case 'AutoFilterOr'*/: break;
default: seen = false;
} break;
/* QueryTable */
case 'QueryTable': switch(Rn[3]) {
case 'Id': break;
case 'AutoFormatFont': break;
case 'AutoFormatPattern': break;
case 'QuerySource': break;
case 'QueryType': break;
case 'EnableRedirections': break;
case 'RefreshedInXl9': break;
case 'URLString': break;
case 'HTMLTables': break;
case 'Connection': break;
case 'CommandText': break;
case 'RefreshInfo': break;
case 'NoTitles': break;
case 'NextId': break;
case 'ColumnInfo': break;
case 'OverwriteCells': break;
case 'DoNotPromptForFile': break;
case 'TextWizardSettings': break;
case 'Source': break;
case 'Number': break;
case 'Decimal': break;
case 'ThousandSeparator': break;
case 'TrailingMinusNumbers': break;
case 'FormatSettings': break;
case 'FieldType': break;
case 'Delimiters': break;
case 'Tab': break;
case 'Comma': break;
case 'AutoFormatName': break;
case 'VersionLastEdit': break;
case 'VersionLastRefresh': break;
case 'querytable' /*case 'QueryTable'*/: switch(Rn[3]) {
case 'id' /*case 'Id'*/: break;
case 'autoformatfont' /*case 'AutoFormatFont'*/: break;
case 'autoformatpattern' /*case 'AutoFormatPattern'*/: break;
case 'querysource' /*case 'QuerySource'*/: break;
case 'querytype' /*case 'QueryType'*/: break;
case 'enableredirections' /*case 'EnableRedirections'*/: break;
case 'refreshedinxl9' /*case 'RefreshedInXl9'*/: break;
case 'urlstring' /*case 'URLString'*/: break;
case 'htmltables' /*case 'HTMLTables'*/: break;
case 'connection' /*case 'Connection'*/: break;
case 'commandtext' /*case 'CommandText'*/: break;
case 'refreshinfo' /*case 'RefreshInfo'*/: break;
case 'notitles' /*case 'NoTitles'*/: break;
case 'nextid' /*case 'NextId'*/: break;
case 'columninfo' /*case 'ColumnInfo'*/: break;
case 'overwritecells' /*case 'OverwriteCells'*/: break;
case 'donotpromptforfile' /*case 'DoNotPromptForFile'*/: break;
case 'textwizardsettings' /*case 'TextWizardSettings'*/: break;
case 'source' /*case 'Source'*/: break;
case 'number' /*case 'Number'*/: break;
case 'decimal' /*case 'Decimal'*/: break;
case 'thousandseparator' /*case 'ThousandSeparator'*/: break;
case 'trailingminusnumbers' /*case 'TrailingMinusNumbers'*/: break;
case 'formatsettings' /*case 'FormatSettings'*/: break;
case 'fieldtype' /*case 'FieldType'*/: break;
case 'delimiters' /*case 'Delimiters'*/: break;
case 'tab' /*case 'Tab'*/: break;
case 'comma' /*case 'Comma'*/: break;
case 'autoformatname' /*case 'AutoFormatName'*/: break;
case 'versionlastedit' /*case 'VersionLastEdit'*/: break;
case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break;
default: seen = false;
} break;
case 'DataValidation':
case 'datavalidation' /*case 'DataValidation'*/:
switch(Rn[3]) {
case 'Range': break;
case 'range' /*case 'Range'*/: dval.ref = Rn; break;
case 'Type': break;
case 'Min': break;
case 'Max': break;
case 'Sort': break;
case 'Descending': break;
case 'Order': break;
case 'CaseSensitive': break;
case 'Value': break;
case 'ErrorStyle': break;
case 'ErrorMessage': break;
case 'ErrorTitle': break;
case 'InputMessage': break;
case 'InputTitle': break;
case 'ComboHide': break;
case 'InputHide': break;
case 'Condition': break;
case 'Qualifier': break;
case 'UseBlank': break;
case 'Value1': break;
case 'Value2': break;
case 'Format': break;
case 'type' /*case 'Type'*/: break;
case 'min' /*case 'Min'*/: break;
case 'max' /*case 'Max'*/: break;
case 'sort' /*case 'Sort'*/: break;
case 'descending' /*case 'Descending'*/: break;
case 'order' /*case 'Order'*/: break;
case 'casesensitive' /*case 'CaseSensitive'*/: break;
case 'value' /*case 'Value'*/: break;
case 'errorstyle' /*case 'ErrorStyle'*/: break;
case 'errormessage' /*case 'ErrorMessage'*/: break;
case 'errortitle' /*case 'ErrorTitle'*/: break;
case 'inputmessage' /*case 'InputMessage'*/: break;
case 'inputtitle' /*case 'InputTitle'*/: break;
case 'combohide' /*case 'ComboHide'*/: break;
case 'inputhide' /*case 'InputHide'*/: break;
case 'condition' /*case 'Condition'*/: break;
case 'qualifier' /*case 'Qualifier'*/: break;
case 'useblank' /*case 'UseBlank'*/: break;
case 'value1' /*case 'Value1'*/: break;
case 'value2' /*case 'Value2'*/: break;
case 'format' /*case 'Format'*/: break;
case 'CellRangeList': break;
case 'cellrangelist' /*case 'CellRangeList'*/: break;
default: seen = false;
} break;
case 'Sorting':
case 'ConditionalFormatting':
case 'sorting' /*case 'Sorting'*/:
case 'conditionalformatting' /*case 'ConditionalFormatting'*/:
switch(Rn[3]) {
case 'Range': break;
case 'Type': break;
case 'Min': break;
case 'Max': break;
case 'Sort': break;
case 'Descending': break;
case 'Order': break;
case 'CaseSensitive': break;
case 'Value': break;
case 'ErrorStyle': break;
case 'ErrorMessage': break;
case 'ErrorTitle': break;
case 'CellRangeList': break;
case 'InputMessage': break;
case 'InputTitle': break;
case 'ComboHide': break;
case 'InputHide': break;
case 'Condition': break;
case 'Qualifier': break;
case 'UseBlank': break;
case 'Value1': break;
case 'Value2': break;
case 'Format': break;
case 'range' /*case 'Range'*/: break;
case 'type' /*case 'Type'*/: break;
case 'min' /*case 'Min'*/: break;
case 'max' /*case 'Max'*/: break;
case 'sort' /*case 'Sort'*/: break;
case 'descending' /*case 'Descending'*/: break;
case 'order' /*case 'Order'*/: break;
case 'casesensitive' /*case 'CaseSensitive'*/: break;
case 'value' /*case 'Value'*/: break;
case 'errorstyle' /*case 'ErrorStyle'*/: break;
case 'errormessage' /*case 'ErrorMessage'*/: break;
case 'errortitle' /*case 'ErrorTitle'*/: break;
case 'cellrangelist' /*case 'CellRangeList'*/: break;
case 'inputmessage' /*case 'InputMessage'*/: break;
case 'inputtitle' /*case 'InputTitle'*/: break;
case 'combohide' /*case 'ComboHide'*/: break;
case 'inputhide' /*case 'InputHide'*/: break;
case 'condition' /*case 'Condition'*/: break;
case 'qualifier' /*case 'Qualifier'*/: break;
case 'useblank' /*case 'UseBlank'*/: break;
case 'value1' /*case 'Value1'*/: break;
case 'value2' /*case 'Value2'*/: break;
case 'format' /*case 'Format'*/: break;
default: seen = false;
} break;
/* MapInfo (schema) */
case 'MapInfo': case 'Schema': case 'data': switch(Rn[3]) {
case 'Map': break;
case 'Entry': break;
case 'Range': break;
case 'XPath': break;
case 'Field': break;
case 'XSDType': break;
case 'FilterOn': break;
case 'Aggregate': break;
case 'ElementType': break;
case 'AttributeType': break;
case 'mapinfo' /*case 'MapInfo'*/: case 'schema' /*case 'Schema'*/: case 'data' /*case 'data'*/: switch(Rn[3]) {
case 'map' /*case 'Map'*/: break;
case 'entry' /*case 'Entry'*/: break;
case 'range' /*case 'Range'*/: break;
case 'xpath' /*case 'XPath'*/: break;
case 'field' /*case 'Field'*/: break;
case 'xsdtype' /*case 'XSDType'*/: break;
case 'filteron' /*case 'FilterOn'*/: break;
case 'aggregate' /*case 'Aggregate'*/: break;
case 'elementtype' /*case 'ElementType'*/: break;
case 'attributetype' /*case 'AttributeType'*/: break;
/* These are from xsd (XML Schema Definition) */
case 'schema':
case 'element':
case 'complexType':
case 'datatype':
case 'all':
case 'attribute':
case 'extends': break;
case 'schema' /*case 'schema'*/:
case 'element' /*case 'element'*/:
case 'complextype' /*case 'complexType'*/:
case 'datatype' /*case 'datatype'*/:
case 'all' /*case 'all'*/:
case 'attribute' /*case 'attribute'*/:
case 'extends' /*case 'extends'*/: break;
case 'row': break;
case 'row' /*case 'row'*/: break;
default: seen = false;
} break;
/* SmartTags (can be anything) */
case 'SmartTags': break;
case 'smarttags' /*case 'SmartTags'*/: break;
default: seen = false; break;
}
@ -866,9 +876,9 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
/* CustomDocumentProperties */
if(Rn[3].match(/!\[CDATA/)) break;
if(!state[state.length-1][1]) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|");
if(state[state.length-1][0]==='CustomDocumentProperties') {
if(state[state.length-1][0]===/*'CustomDocumentProperties'*/'customdocumentproperties') {
if(Rn[0].slice(-2) === "/>") break;
else if(Rn[1]==="/") xlml_set_custprop(Custprops, Rn[3], cp, str.slice(pidx, Rn.index));
else if(Rn[1]==="/") xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index));
else { cp = Rn; pidx = Rn.index + Rn[0].length; }
break;
}

View File

@ -15654,7 +15654,7 @@ function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, a
break;
case 'String':
cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml));
cell.v = xml.indexOf("<") > -1 ? unescapexml(ss||xml) : cell.r;
cell.v = (xml.indexOf("<") > -1 ? unescapexml(ss||xml).replace(/<.*?>/g, "") : cell.r); // todo: BR etc
break;
case 'DateTime':
if(xml.slice(-1) != "Z") xml += "Z";
@ -15750,13 +15750,19 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false} }/*:any*/), wsprops = {};
xlmlregex.lastIndex = 0;
str = str.replace(/<!--([\s\S]*?)-->/mg,"");
while((Rn = xlmlregex.exec(str))) switch(Rn[3]) {
case 'Data':
var raw_Rn3 = "";
while((Rn = xlmlregex.exec(str))) switch((Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase())) {
case 'data' /*case 'Data'*/:
if(raw_Rn3 == "data") {
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
break;
}
if(state[state.length-1][1]) break;
if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]=="Comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts);
if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]==/*"Comment"*/"comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts);
else { ss = ""; dtag = xlml_parsexmltag(Rn[0]); didx = Rn.index + Rn[0].length; }
break;
case 'Cell':
case 'cell' /*case 'Cell'*/:
if(Rn[1]==='/'){
if(comments.length > 0) cell.c = comments;
if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== undefined) {
@ -15800,7 +15806,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
comments = [];
}
break;
case 'Row':
case 'row' /*case 'Row'*/:
if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") {
if(r < refguess.s.r) refguess.s.r = r;
if(r > refguess.e.r) refguess.e.r = r;
@ -15820,7 +15826,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; }
}
break;
case 'Worksheet': /* TODO: read range from FullRows/FullColumns */
case 'worksheet' /*case 'Worksheet'*/: /* TODO: read range from FullRows/FullColumns */
if(Rn[1]==='/'){
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
sheetnames.push(sheetname);
@ -15850,7 +15856,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
Workbook.Sheets.push(wsprops);
}
break;
case 'Table':
case 'table' /*case 'Table'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].slice(-2) == "/>") break;
else {
@ -15860,20 +15866,20 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'Style':
case 'style' /*case 'Style'*/:
if(Rn[1]==='/') process_style_xlml(styles, stag, opts);
else stag = xlml_parsexmltag(Rn[0]);
break;
case 'NumberFormat':
case 'numberformat' /*case 'NumberFormat'*/:
stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General");
if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf];
for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == stag.nf) break;
if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == null) { SSF.load(stag.nf, ssfidx); break; }
break;
case 'Column':
if(state[state.length-1][0] !== 'Table') break;
case 'column' /*case 'Column'*/:
if(state[state.length-1][0] !== /*'Table'*/'table') break;
csty = xlml_parsexmltag(Rn[0]);
if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; }
if(csty.Width) csty.wpx = parseInt(csty.Width, 10);
@ -15886,7 +15892,8 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
for(var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty);
break;
case 'NamedRange':
case 'namedrange' /*case 'NamedRange'*/:
if(Rn[1]==='/') break;
if(!Workbook.Names) Workbook.Names = [];
var _NamedRange = parsexmltag(Rn[0]);
var _DefinedName/*:DefinedName*/ = ({
@ -15897,62 +15904,65 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
/*:: if(Workbook.Names) */Workbook.Names.push(_DefinedName);
break;
case 'NamedCell': break;
case 'B': break;
case 'I': break;
case 'U': break;
case 'S': break;
case 'Sub': break;
case 'Sup': break;
case 'Span': break;
case 'Alignment':
case 'namedcell' /*case 'NamedCell'*/: break;
case 'b' /*case 'B'*/: break;
case 'i' /*case 'I'*/: break;
case 'u' /*case 'U'*/: break;
case 's' /*case 'S'*/: break;
case 'em' /*case 'EM'*/: break;
case 'h2' /*case 'H2'*/: break;
case 'h3' /*case 'H3'*/: break;
case 'sub' /*case 'Sub'*/: break;
case 'sup' /*case 'Sup'*/: break;
case 'span' /*case 'Span'*/: break;
case 'alignment' /*case 'Alignment'*/:
break;
case 'Borders': break;
case 'Border': break;
case 'Font':
case 'borders' /*case 'Borders'*/: break;
case 'border' /*case 'Border'*/: break;
case 'font' /*case 'Font'*/:
if(Rn[0].slice(-2) === "/>") break;
else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index);
else fidx = Rn.index + Rn[0].length;
break;
case 'Interior':
case 'interior' /*case 'Interior'*/:
if(!opts.cellStyles) break;
stag.Interior = xlml_parsexmltag(Rn[0]);
break;
case 'Protection': break;
case 'protection' /*case 'Protection'*/: break;
case 'Author':
case 'Title':
case 'Description':
case 'Created':
case 'Keywords':
case 'Subject':
case 'Category':
case 'Company':
case 'LastAuthor':
case 'LastSaved':
case 'LastPrinted':
case 'Version':
case 'Revision':
case 'TotalTime':
case 'HyperlinkBase':
case 'Manager':
case 'ContentStatus':
case 'Identifier':
case 'Language':
case 'AppName':
case 'author' /*case 'Author'*/:
case 'title' /*case 'Title'*/:
case 'description' /*case 'Description'*/:
case 'created' /*case 'Created'*/:
case 'keywords' /*case 'Keywords'*/:
case 'subject' /*case 'Subject'*/:
case 'category' /*case 'Category'*/:
case 'company' /*case 'Company'*/:
case 'lastauthor' /*case 'LastAuthor'*/:
case 'lastsaved' /*case 'LastSaved'*/:
case 'lastprinted' /*case 'LastPrinted'*/:
case 'version' /*case 'Version'*/:
case 'revision' /*case 'Revision'*/:
case 'totaltime' /*case 'TotalTime'*/:
case 'hyperlinkbase' /*case 'HyperlinkBase'*/:
case 'manager' /*case 'Manager'*/:
case 'contentstatus' /*case 'ContentStatus'*/:
case 'identifier' /*case 'Identifier'*/:
case 'language' /*case 'Language'*/:
case 'appname' /*case 'AppName'*/:
if(Rn[0].slice(-2) === "/>") break;
else if(Rn[1]==="/") xlml_set_prop(Props, Rn[3], str.slice(pidx, Rn.index));
else if(Rn[1]==="/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index));
else pidx = Rn.index + Rn[0].length;
break;
case 'Paragraphs': break;
case 'paragraphs' /*case 'Paragraphs'*/: break;
case 'Styles':
case 'Workbook':
case 'styles' /*case 'Styles'*/:
case 'workbook' /*case 'Workbook'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else state.push([Rn[3], false]);
break;
case 'Comment':
case 'comment' /*case 'Comment'*/:
if(Rn[1]==='/'){
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
xlml_clean_comment(comment);
@ -15964,7 +15974,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'AutoFilter':
case 'autofilter' /*case 'AutoFilter'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
var AutoFilter = xlml_parsexmltag(Rn[0]);
@ -15973,9 +15983,9 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'Name': break;
case 'name' /*case 'Name'*/: break;
case 'DataValidation':
case 'datavalidation' /*case 'DataValidation'*/:
if(Rn[1]==='/'){
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
} else {
@ -15983,25 +15993,26 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
}
break;
case 'ComponentOptions':
case 'DocumentProperties':
case 'CustomDocumentProperties':
case 'OfficeDocumentSettings':
case 'PivotTable':
case 'PivotCache':
case 'Names':
case 'MapInfo':
case 'PageBreaks':
case 'QueryTable':
case 'Sorting':
case 'Schema':
case 'data':
case 'ConditionalFormatting':
case 'SmartTagType':
case 'SmartTags':
case 'ExcelWorkbook':
case 'WorkbookOptions':
case 'WorksheetOptions':
case 'pixelsperinch' /*case 'PixelsPerInch'*/:
break;
case 'componentoptions' /*case 'ComponentOptions'*/:
case 'documentproperties' /*case 'DocumentProperties'*/:
case 'customdocumentproperties' /*case 'CustomDocumentProperties'*/:
case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/:
case 'pivottable' /*case 'PivotTable'*/:
case 'pivotcache' /*case 'PivotCache'*/:
case 'names' /*case 'Names'*/:
case 'mapinfo' /*case 'MapInfo'*/:
case 'pagebreaks' /*case 'PageBreaks'*/:
case 'querytable' /*case 'QueryTable'*/:
case 'sorting' /*case 'Sorting'*/:
case 'schema' /*case 'Schema'*/: //case 'data' /*case 'data'*/:
case 'conditionalformatting' /*case 'ConditionalFormatting'*/:
case 'smarttagtype' /*case 'SmartTagType'*/:
case 'smarttags' /*case 'SmartTags'*/:
case 'excelworkbook' /*case 'ExcelWorkbook'*/:
case 'workbookoptions' /*case 'WorkbookOptions'*/:
case 'worksheetoptions' /*case 'WorksheetOptions'*/:
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
break;
@ -16010,104 +16021,103 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
/* FODS file root is <office:document> */
if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts);
/* UOS file root is <uof:UOF> */
if(state.length == 0 && Rn[3] == "UOF") return parse_fods(str, opts);
if(state.length == 0 && Rn[3] == "uof"/*"UOF"*/) return parse_fods(str, opts);
var seen = true;
switch(state[state.length-1][0]) {
/* OfficeDocumentSettings */
case 'OfficeDocumentSettings': switch(Rn[3]) {
case 'AllowPNG': break;
case 'RemovePersonalInformation': break;
case 'DownloadComponents': break;
case 'LocationOfComponents': break;
case 'Colors': break;
case 'Color': break;
case 'Index': break;
case 'RGB': break;
case 'PixelsPerInch': break; // TODO: set PPI
case 'TargetScreenSize': break;
case 'ReadOnlyRecommended': break;
case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: switch(Rn[3]) {
case 'allowpng' /*case 'AllowPNG'*/: break;
case 'removepersonalinformation' /*case 'RemovePersonalInformation'*/: break;
case 'downloadcomponents' /*case 'DownloadComponents'*/: break;
case 'locationofcomponents' /*case 'LocationOfComponents'*/: break;
case 'colors' /*case 'Colors'*/: break;
case 'color' /*case 'Color'*/: break;
case 'index' /*case 'Index'*/: break;
case 'rgb' /*case 'RGB'*/: break;
case 'targetscreensize' /*case 'TargetScreenSize'*/: break;
case 'readonlyrecommended' /*case 'ReadOnlyRecommended'*/: break;
default: seen = false;
} break;
/* ComponentOptions */
case 'ComponentOptions': switch(Rn[3]) {
case 'Toolbar': break;
case 'HideOfficeLogo': break;
case 'SpreadsheetAutoFit': break;
case 'Label': break;
case 'Caption': break;
case 'MaxHeight': break;
case 'MaxWidth': break;
case 'NextSheetNumber': break;
case 'componentoptions' /*case 'ComponentOptions'*/: switch(Rn[3]) {
case 'toolbar' /*case 'Toolbar'*/: break;
case 'hideofficelogo' /*case 'HideOfficeLogo'*/: break;
case 'spreadsheetautofit' /*case 'SpreadsheetAutoFit'*/: break;
case 'label' /*case 'Label'*/: break;
case 'caption' /*case 'Caption'*/: break;
case 'maxheight' /*case 'MaxHeight'*/: break;
case 'maxwidth' /*case 'MaxWidth'*/: break;
case 'nextsheetnumber' /*case 'NextSheetNumber'*/: break;
default: seen = false;
} break;
/* ExcelWorkbook */
case 'ExcelWorkbook': switch(Rn[3]) {
case 'Date1904':
case 'excelworkbook' /*case 'ExcelWorkbook'*/: switch(Rn[3]) {
case 'date1904' /*case 'Date1904'*/:
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
Workbook.WBProps.date1904 = true;
break;
case 'WindowHeight': break;
case 'WindowWidth': break;
case 'WindowTopX': break;
case 'WindowTopY': break;
<