var write_content_xml/*:{(wb:any, opts:any):string}*/ = (function() { var null_cell_xml = ' \n'; var write_ws = function(ws, wb, i/*:number*/, opts)/*:string*/ { /* Section 9 Tables */ var o = []; o.push(' \n'); var R=0,C=0, range = decode_range(ws['!ref']); for(R = 0; R < range.s.r; ++R) o.push(' \n'); for(; R <= range.e.r; ++R) { o.push(' \n'); for(C=0; C < range.s.c; ++C) o.push(null_cell_xml); for(; C <= range.e.c; ++C) { var ref = encode_cell({r:R, c:C}), cell = ws[ref]; if(cell) switch(cell.t) { case 'b': o.push(' ' + (cell.v ? 'TRUE' : 'FALSE') + '\n'); break; case 'n': o.push(' ' + (cell.w||cell.v) + '\n'); break; case 's': case 'str': o.push(' ' + escapexml(cell.v) + '\n'); break; //case 'd': // TODO //case 'e': default: o.push(null_cell_xml); } else o.push(null_cell_xml); } o.push(' \n'); } o.push(' \n'); return o.join(""); }; return function wcx(wb, opts) { var o = [XML_HEADER]; /* 3.1.3.2 */ if(opts.bookType == "fods") o.push(''); else o.push('\n'); // TODO o.push(' \n'); o.push(' \n'); for(var i = 0; i != wb.SheetNames.length; ++i) o.push(write_ws(wb.Sheets[wb.SheetNames[i]], wb, i, opts)); o.push(' \n'); o.push(' \n'); if(opts.bookType == "fods") o.push(''); else o.push(''); return o.join(""); }; })();