| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | /* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */ | 
					
						
							|  |  |  | /* 12.3 Part Summary <SpreadsheetML> */ | 
					
						
							|  |  |  | /* 14.2 Part Summary <DrawingML> */ | 
					
						
							| 
									
										
										
										
											2018-02-14 20:06:35 +00:00
										 |  |  | /* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */ | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | var ct2type/*{[string]:string}*/ = ({ | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	/* Workbook */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks", | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	"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", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* Worksheet */ | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.worksheet": "sheets", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	"application/vnd.ms-excel.binIndexWs": "TODO", /* Binary Index */ | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	/* Chartsheet */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.chartsheet": "charts", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	/* Macrosheet */ | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	"application/vnd.ms-excel.macrosheet+xml": "macros", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.macrosheet": "macros", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	"application/vnd.ms-excel.intlmacrosheet": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.binIndexMs": "TODO", /* Binary Index */ | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	/* 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", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	/* File Properties */ | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 	"application/vnd.openxmlformats-package.core-properties+xml": "coreprops", | 
					
						
							| 
									
										
										
										
											2014-02-14 03:39:03 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Custom Data Properties */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO", | 
					
						
							| 
									
										
										
										
											2017-03-27 21:35:15 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	/* Comments */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.comments": "comments", | 
					
						
							| 
									
										
										
										
											2022-03-14 06:51:33 +00:00
										 |  |  | 	"application/vnd.ms-excel.threadedcomments+xml": "threadedcomments", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.person+xml": "people", | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* Metadata (Stock/Geography and Dynamic Array) */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.sheetMetadata": "metadata", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	/* PivotTable */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.pivotTable": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 03:09:14 +00:00
										 |  |  | 	/* Chart Objects */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.drawingml.chart+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 20:36:32 +00:00
										 |  |  | 	/* Chart Colors */ | 
					
						
							|  |  |  | 	"application/vnd.ms-office.chartcolorstyle+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Chart Style */ | 
					
						
							|  |  |  | 	"application/vnd.ms-office.chartstyle+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 03:09:14 +00:00
										 |  |  | 	/* Chart Advanced */ | 
					
						
							|  |  |  | 	"application/vnd.ms-office.chartex+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	/* Calculation Chain */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.calcChain": "calcchains", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Printer Settings */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* ActiveX */ | 
					
						
							|  |  |  | 	"application/vnd.ms-office.activeX": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-office.activeX+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Custom Toolbars */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.attachedToolbars": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* External Data Connections */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.connections": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* External Links */ | 
					
						
							| 
									
										
										
										
											2017-07-27 20:07:51 +00:00
										 |  |  | 	"application/vnd.ms-excel.externalLink": "links", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* PivotCache */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.pivotCacheDefinition": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.pivotCacheRecords": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Query Table */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.queryTable": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Shared Workbook */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.userNames": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.revisionHeaders": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.revisionLog": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Single Cell Table */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.tableSingleCells": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Slicer */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.slicer": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.slicerCache": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.slicer+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.slicerCache+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Sort Map */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.wsSortMap": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Table */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.table": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Themes */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.theme+xml": "themes", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-27 21:35:15 +00:00
										 |  |  | 	/* Theme Override */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	/* Timeline */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.Timeline+xml": "TODO", /* verify */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.TimelineCache+xml": "TODO", /* verify */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* VBA */ | 
					
						
							|  |  |  | 	"application/vnd.ms-office.vbaProject": "vba", | 
					
						
							| 
									
										
										
										
											2022-02-08 09:50:51 +00:00
										 |  |  | 	"application/vnd.ms-office.vbaProjectSignature": "TODO", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* Volatile Dependencies */ | 
					
						
							|  |  |  | 	"application/vnd.ms-office.volatileDependencies": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Control Properties */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.controlproperties+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Data Model */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.model+data": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Survey */ | 
					
						
							|  |  |  | 	"application/vnd.ms-excel.Survey+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Drawing */ | 
					
						
							| 
									
										
										
										
											2017-04-08 06:55:35 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.drawing+xml": "drawings", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml": "TODO", | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* VML */ | 
					
						
							|  |  |  | 	"application/vnd.openxmlformats-officedocument.vmlDrawing": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	"application/vnd.openxmlformats-package.relationships+xml": "rels", | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	"application/vnd.openxmlformats-officedocument.oleObject": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-27 21:35:15 +00:00
										 |  |  | 	/* Image */ | 
					
						
							|  |  |  | 	"image/png": "TODO", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	"sheet": "js" | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | }/*:any*/); | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var CT_LIST = { | 
					
						
							| 
									
										
										
										
											2022-05-22 23:51:41 +00:00
										 |  |  | 	workbooks: { | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", | 
					
						
							|  |  |  | 		xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main", | 
					
						
							|  |  |  | 		xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml", | 
					
						
							|  |  |  | 		xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	strs: { /* Shared Strings */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.sharedStrings" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	comments: { /* Comments */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.comments" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	sheets: { /* Worksheet */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.worksheet" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	charts: { /* Chartsheet */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.chartsheet" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	dialogs: { /* Dialogsheet */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.dialogsheet" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	macros: { /* Macrosheet (Excel 4.0 Macros) */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.ms-excel.macrosheet+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.macrosheet" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	metadata: { /* Metadata (Stock/Geography and Dynamic Array) */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.sheetMetadata" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	styles: { /* Styles */ | 
					
						
							|  |  |  | 		xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", | 
					
						
							|  |  |  | 		xlsb: "application/vnd.ms-excel.styles" | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-27 20:07:51 +00:00
										 |  |  | function new_ct()/*:any*/ { | 
					
						
							|  |  |  | 	return ({ | 
					
						
							| 
									
										
										
										
											2017-03-28 04:41:01 +00:00
										 |  |  | 		workbooks:[], sheets:[], charts:[], dialogs:[], macros:[], | 
					
						
							| 
									
										
										
										
											2022-03-14 06:51:33 +00:00
										 |  |  | 		rels:[], strs:[], comments:[], threadedcomments:[], links:[], | 
					
						
							| 
									
										
										
										
											2017-03-27 21:35:15 +00:00
										 |  |  | 		coreprops:[], extprops:[], custprops:[], themes:[], styles:[], | 
					
						
							| 
									
										
										
										
											2022-03-14 06:51:33 +00:00
										 |  |  | 		calcchains:[], vba: [], drawings: [], metadata: [], people:[], | 
					
						
							| 
									
										
										
										
											2017-03-27 21:35:15 +00:00
										 |  |  | 		TODO:[], xmlns: "" }/*:any*/); | 
					
						
							| 
									
										
										
										
											2017-07-27 20:07:51 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-23 09:07:51 +00:00
										 |  |  | function parse_ct(data/*:?string*/) { | 
					
						
							| 
									
										
										
										
											2017-07-27 20:07:51 +00:00
										 |  |  | 	var ct = new_ct(); | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | 	if(!data || !data.match) return ct; | 
					
						
							|  |  |  | 	var ctext = {}; | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	(data.match(tagregex)||[]).forEach(function(x) { | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 		var y = parsexmltag(x); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		switch(y[0].replace(nsregex,"<")) { | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 			case '<?xml': break; | 
					
						
							| 
									
										
										
										
											2014-05-22 12:16:51 +00:00
										 |  |  | 			case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break; | 
					
						
							| 
									
										
										
										
											2022-05-22 23:51:41 +00:00
										 |  |  | 			case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break; | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 			case '<Override': | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 				if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName); | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 				break; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	if(ct.xmlns !== XMLNS.CT) throw new Error("Unknown Namespace: " + ct.xmlns); | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 	ct.calcchain = ct.calcchains.length > 0 ? ct.calcchains[0] : ""; | 
					
						
							|  |  |  | 	ct.sst = ct.strs.length > 0 ? ct.strs[0] : ""; | 
					
						
							|  |  |  | 	ct.style = ct.styles.length > 0 ? ct.styles[0] : ""; | 
					
						
							| 
									
										
										
										
											2014-04-03 22:51:54 +00:00
										 |  |  | 	ct.defaults = ctext; | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 	delete ct.calcchains; | 
					
						
							|  |  |  | 	return ct; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 23:51:41 +00:00
										 |  |  | function write_ct(ct, opts, raw)/*:string*/ { | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | 	var o/*:Array<string>*/ = [], v; | 
					
						
							| 
									
										
										
										
											2022-03-20 01:54:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 23:51:41 +00:00
										 |  |  | 	if(!raw) { | 
					
						
							|  |  |  | 		o[o.length] = (XML_HEADER); | 
					
						
							|  |  |  | 		o[o.length] = writextag('Types', null, { | 
					
						
							|  |  |  | 			'xmlns': XMLNS.CT, | 
					
						
							|  |  |  | 			'xmlns:xsd': XMLNS.xsd, | 
					
						
							|  |  |  | 			'xmlns:xsi': XMLNS.xsi | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 		o = o.concat([ | 
					
						
							|  |  |  | 			['xml', 'application/xml'], | 
					
						
							|  |  |  | 			['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'], | 
					
						
							|  |  |  | 			['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'], | 
					
						
							|  |  |  | 			['data', 'application/vnd.openxmlformats-officedocument.model+data'], | 
					
						
							|  |  |  | 			/* from test files */ | 
					
						
							|  |  |  | 			['bmp', 'image/bmp'], | 
					
						
							|  |  |  | 			['png', 'image/png'], | 
					
						
							|  |  |  | 			['gif', 'image/gif'], | 
					
						
							|  |  |  | 			['emf', 'image/x-emf'], | 
					
						
							|  |  |  | 			['wmf', 'image/x-wmf'], | 
					
						
							|  |  |  | 			['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'], | 
					
						
							|  |  |  | 			['tif', 'image/tiff'], ['tiff', 'image/tiff'], | 
					
						
							|  |  |  | 			['pdf', 'application/pdf'], | 
					
						
							|  |  |  | 			['rels', 'application/vnd.openxmlformats-package.relationships+xml'] | 
					
						
							|  |  |  | 		].map(function(x) { | 
					
						
							|  |  |  | 			return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]}); | 
					
						
							|  |  |  | 		})); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-01 03:09:14 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* only write first instance */ | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	var f1 = function(w) { | 
					
						
							|  |  |  | 		if(ct[w] && ct[w].length > 0) { | 
					
						
							|  |  |  | 			v = ct[w][0]; | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 			o[o.length] = (writextag('Override', null, { | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 				'PartName': (v[0] == '/' ? "":"/") + v, | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 				'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx'] | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 			})); | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2014-01-29 06:00:09 +00:00
										 |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2019-11-01 03:09:14 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* book type-specific */ | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	var f2 = function(w) { | 
					
						
							| 
									
										
										
										
											2017-04-08 06:55:35 +00:00
										 |  |  | 		(ct[w]||[]).forEach(function(v) { | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 			o[o.length] = (writextag('Override', null, { | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 				'PartName': (v[0] == '/' ? "":"/") + v, | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 				'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx'] | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 			})); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2019-11-01 03:09:14 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* standard type */ | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	var f3 = function(t) { | 
					
						
							|  |  |  | 		(ct[t]||[]).forEach(function(v) { | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 			o[o.length] = (writextag('Override', null, { | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 				'PartName': (v[0] == '/' ? "":"/") + v, | 
					
						
							|  |  |  | 				'ContentType': type2ct[t][0] | 
					
						
							|  |  |  | 			})); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2019-11-01 03:09:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	f1('workbooks'); | 
					
						
							|  |  |  | 	f2('sheets'); | 
					
						
							| 
									
										
										
										
											2017-04-08 06:55:35 +00:00
										 |  |  | 	f2('charts'); | 
					
						
							| 
									
										
										
										
											2014-05-16 00:50:55 +00:00
										 |  |  | 	f3('themes'); | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	['strs', 'styles'].forEach(f1); | 
					
						
							|  |  |  | 	['coreprops', 'extprops', 'custprops'].forEach(f3); | 
					
						
							| 
									
										
										
										
											2017-03-28 04:41:01 +00:00
										 |  |  | 	f3('vba'); | 
					
						
							| 
									
										
										
										
											2017-04-08 06:55:35 +00:00
										 |  |  | 	f3('comments'); | 
					
						
							| 
									
										
										
										
											2022-03-14 06:51:33 +00:00
										 |  |  | 	f3('threadedcomments'); | 
					
						
							| 
									
										
										
										
											2017-04-08 06:55:35 +00:00
										 |  |  | 	f3('drawings'); | 
					
						
							| 
									
										
										
										
											2022-03-03 08:35:39 +00:00
										 |  |  | 	f2('metadata'); | 
					
						
							| 
									
										
										
										
											2022-03-14 06:51:33 +00:00
										 |  |  | 	f3('people'); | 
					
						
							| 
									
										
										
										
											2022-05-22 23:51:41 +00:00
										 |  |  | 	if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); } | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	return o.join(""); | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | } |