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});
|
2017-04-01 07:32:12 +00:00
|
|
|
var write_slk_str = write_obj_str(SYLK);
|
|
|
|
var write_dif_str = write_obj_str(DIF);
|
2017-04-03 00:16:03 +00:00
|
|
|
var write_prn_str = write_obj_str(PRN);
|
2017-08-05 06:32:57 +00:00
|
|
|
var write_rtf_str = write_obj_str(RTF);
|
2017-04-03 00:16:03 +00:00
|
|
|
var write_txt_str = write_obj_str({from_sheet:sheet_to_txt});
|
2017-10-27 16:25:54 +00:00
|
|
|
// $FlowIgnore
|
|
|
|
var write_dbf_buf = write_obj_str(DBF);
|
|
|
|
|