Skip to content

Commit a80f0ab

Browse files
seriousbensaarCiklum
authored andcommitted
XLSX write sheetFormat option (fixes SheetJS#437)
note: @SheetJSDev authored commit, original PR date/author used
1 parent 1e4871f commit a80f0ab

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

bits/67_wsxml.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
323323
o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])}));
324324
o[o.length] = (writextag('dimension', null, {'ref': ref}));
325325

326+
/* TODO: store in WB, process styles */
327+
if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', baseColWidth:opts.sheetFormat.baseColWidth||'10' }))
328+
326329
if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols']));
327330
o[sidx = o.length] = '<sheetData/>';
328331
ws['!links'] = [];

xlsx.flow.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9224,6 +9224,9 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
92249224
o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])}));
92259225
o[o.length] = (writextag('dimension', null, {'ref': ref}));
92269226

9227+
/* TODO: store in WB, process styles */
9228+
if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', baseColWidth:opts.sheetFormat.baseColWidth||'10' }))
9229+
92279230
if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols']));
92289231
o[sidx = o.length] = '<sheetData/>';
92299232
ws['!links'] = [];

xlsx.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9382,6 +9382,9 @@ function write_ws_xml(idx, opts, wb, rels) {
93829382
o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])}));
93839383
o[o.length] = (writextag('dimension', null, {'ref': ref}));
93849384

9385+
/* TODO: store in WB, process styles */
9386+
if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', baseColWidth:opts.sheetFormat.baseColWidth||'10' }))
9387+
93859388
if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols']));
93869389
o[sidx = o.length] = '<sheetData/>';
93879390
ws['!links'] = [];

0 commit comments

Comments
 (0)