docs: function write_ws_xlml_wsopts(ws, opts, idx, wb) {
  	if(!ws) return "";
  	var o = [];
  	/* NOTE: spec technically allows any order, but stick with implied order */
  
  	/* FitToPage */
  	/* DoNotDisplayColHeaders */
  	/* DoNotDisplayRowHeaders */
  	/* ViewableRange */
  	/* Selection */
  	/* GridlineColor */
  	/* Name */
  	/* ExcelWorksheetType */
  	/* IntlMacro */
  	/* Unsynced */
  	/* Selected */
  	/* CodeName */
  
  	if(ws['!margins']) {
  		o.push("<PageSetup>");
  		if(ws['!margins'].header) o.push(writextag("Header", null, {'x:Margin':ws['!margins'].header}));
  		if(ws['!margins'].footer) o.push(writextag("Footer", null, {'x:Margin':ws['!margins'].footer}));
  		o.push(writextag("PageMargins", null, {
  			'x:Bottom': ws['!margins'].bottom || "0.75",
  			'x:Left': ws['!margins'].left || "0.7",
  			'x:Right': ws['!margins'].right || "0.7",
  			'x:Top': ws['!margins'].top || "0.75"
  		}));
  		o.push("</PageSetup>");
  	}
  
  	/* PageSetup */
  	/* DisplayPageBreak */
  	/* TransitionExpressionEvaluation */
  	/* TransitionFormulaEntry */
  	/* Print */
  	/* Zoom */
  	/* PageLayoutZoom */
  	/* PageBreakZoom */
  	/* ShowPageBreakZoom */
  	/* DefaultRowHeight */
  	/* DefaultColumnWidth */
  	/* StandardWidth */
  
  	if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) {
  		/* Visible */
  		if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == 1 ? "SheetHidden" : "SheetVeryHidden"), {}));
  		else {
  			/* Selected */
  			for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break;
  			if(i == idx) o.push("<Selected/>");
  		}
  	}
  
  	/* LeftColumnVisible */
  
  	if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push("<DisplayRightToLeft/>");
  
  	/* GridlineColorIndex */
  	/* DisplayFormulas */
  	/* DoNotDisplayGridlines */
  	/* DoNotDisplayHeadings */
  	/* DoNotDisplayOutline */
  	/* ApplyAutomaticOutlineStyles */
  	/* NoSummaryRowsBelowDetail */
  	/* NoSummaryColumnsRightDetail */
  	/* DoNotDisplayZeros */
  	/* ActiveRow */
  	/* ActiveColumn */
  	/* FilterOn */
  	/* RangeSelection */
  	/* TopRowVisible */
  	/* TopRowBottomPane */
  	/* LeftColumnRightPane */
  	/* ActivePane */
  	/* SplitHorizontal */
  	/* SplitVertical */
  	/* FreezePanes */
  	/* FrozenNoSplit */
  	/* TabColorIndex */
  	/* Panes */
  
  	/* NOTE: Password not supported in XLML Format */
  	if(ws['!protect']) {
  		o.push(writetag("ProtectContents", "True"));
  		if(ws['!protect'].objects) o.push(writetag("ProtectObjects", "True"));
  		if(ws['!protect'].scenarios) o.push(writetag("ProtectScenarios", "True"));
  		if(ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) o.push(writetag("EnableSelection", "NoSelection"));
  		else if(ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) o.push(writetag("EnableSelection", "UnlockedCells"));
  	[
  		[ "formatCells", "AllowFormatCells" ],
  		[ "formatColumns", "AllowSizeCols" ],
  		[ "formatRows", "AllowSizeRows" ],
  		[ "insertColumns", "AllowInsertCols" ],
  		[ "insertRows", "AllowInsertRows" ],
  		[ "insertHyperlinks", "AllowInsertHyperlinks" ],
  		[ "deleteColumns", "AllowDeleteCols" ],
  		[ "deleteRows", "AllowDeleteRows" ],
  		[ "sort", "AllowSort" ],
  		[ "autoFilter", "AllowFilter" ],
  		[ "pivotTables", "AllowUsePivotTables" ]
  	].forEach(function(x) { if(ws['!protect'][x[0]]) o.push("<"+x[1]+"/>"); });
  	}
  
  	if(o.length == 0) return "";
  	return writextag("WorksheetOptions", o.join(""), {xmlns:XLMLNS.x});
  }