From 52a55afe7a522014e2b5b10323a97c77f838e21a Mon Sep 17 00:00:00 2001 From: Dunya Almasmari <37501477+Thenmee@users.noreply.github.com> Date: Sun, 29 May 2022 10:41:31 +0300 Subject: [PATCH] adding rtl function for the sheet --- xlsx.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xlsx.js b/xlsx.js index 6bca3c673..9fd291cdf 100644 --- a/xlsx.js +++ b/xlsx.js @@ -7680,6 +7680,12 @@ function write_ws_xml_cols(ws, cols) { o[o.length] = ""; return o.join(""); } +function write_ws_xml_sheetviews(ws, opts, idx, wb) { + var sview = ({workbookViewId:"0"}); + // $FlowIgnore + if((((wb||{}).Workbook||{}).Views||[])[0]) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0"; + return writextag("sheetViews", writextag("sheetView", null, sview), {}); +} function write_ws_xml_cell(cell, ref, ws, opts, idx, wb) { if (cell.v === undefined && cell.s === undefined) return ""; @@ -7925,7 +7931,8 @@ function write_ws_xml(idx, opts, wb) { tabSelected: opts.tabSelected === undefined ? '0' : opts.tabSelected, // see issue #26, need to set WorkbookViews if this is set workbookViewId: opts.workbookViewId === undefined ? '0' : opts.workbookViewId }); - o[o.length] = writextag('sheetViews', sheetView); +// o[o.length] = writextag('sheetViews', sheetView); + o[o.length] = write_ws_xml_sheetviews(ws, opts, idx, wb); if (ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); o[sidx = o.length] = '';