2017-10-27 16:25:54 +00:00
|
|
|
function write_sheet_index(wb/*:Workbook*/, sheet/*:?string*/)/*:number*/ {
|
|
|
|
if(!sheet) return 0;
|
|
|
|
var idx = wb.SheetNames.indexOf(sheet);
|
|
|
|
if(idx == -1) throw new Error("Sheet not found: " + sheet);
|
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
|
2017-04-03 00:16:03 +00:00
|
|
|
function write_obj_str(factory/*:WriteObjStrFactory*/) {
|
|
|
|
return function write_str(wb/*:Workbook*/, o/*:WriteOpts*/)/*:string*/ {
|
2017-10-27 16:25:54 +00:00
|
|
|
var idx = write_sheet_index(wb, o.sheet);
|
2017-06-10 01:47:42 +00:00
|
|
|
return factory.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb);
|
2017-04-01 07:32:12 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-04-16 04:32:13 +00:00
|
|
|
var write_htm_str = write_obj_str(HTML_);
|
2017-04-03 00:16:03 +00:00
|
|
|
var write_csv_str = write_obj_str({from_sheet:sheet_to_csv});
|
2019-08-04 19:50:49 +00:00
|
|
|
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 : {});
|
2017-04-03 00:16:03 +00:00
|
|
|
var write_txt_str = write_obj_str({from_sheet:sheet_to_txt});
|
2019-08-04 19:50:49 +00:00
|
|
|
var write_dbf_buf = write_obj_str(typeof DBF !== "undefined" ? DBF : {});
|
|
|
|
var write_eth_str = write_obj_str(typeof ETH !== "undefined" ? ETH : {});
|
2017-10-27 16:25:54 +00:00
|
|
|
|