From 563efd88f1aac11566df2a407e6022735619087c Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Thu, 30 Mar 2017 23:23:52 -0400 Subject: [PATCH] XLSX write sheetFormat option (fixes #437) note: @sheetjsdev authored commit, original PR date/author used --- bits/67_wsxml.js | 3 +++ xlsx.flow.js | 3 +++ xlsx.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/bits/67_wsxml.js b/bits/67_wsxml.js index 81a9c4d..dd8ee8b 100644 --- a/bits/67_wsxml.js +++ b/bits/67_wsxml.js @@ -323,6 +323,9 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])})); o[o.length] = (writextag('dimension', null, {'ref': ref})); + /* TODO: store in WB, process styles */ + if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', baseColWidth:opts.sheetFormat.baseColWidth||'10' })) + if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); o[sidx = o.length] = ''; ws['!links'] = []; diff --git a/xlsx.flow.js b/xlsx.flow.js index d3c9c34..4ef78ee 100644 --- a/xlsx.flow.js +++ b/xlsx.flow.js @@ -9224,6 +9224,9 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])})); o[o.length] = (writextag('dimension', null, {'ref': ref})); + /* TODO: store in WB, process styles */ + if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', baseColWidth:opts.sheetFormat.baseColWidth||'10' })) + if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); o[sidx = o.length] = ''; ws['!links'] = []; diff --git a/xlsx.js b/xlsx.js index b153435..72896aa 100644 --- a/xlsx.js +++ b/xlsx.js @@ -9169,6 +9169,9 @@ function write_ws_xml(idx, opts, wb, rels) { o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])})); o[o.length] = (writextag('dimension', null, {'ref': ref})); + /* TODO: store in WB, process styles */ + if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', baseColWidth:opts.sheetFormat.baseColWidth||'10' })) + if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); o[sidx = o.length] = ''; ws['!links'] = [];