Skip to content

adding rtl function for the sheet #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion xlsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -7680,6 +7680,12 @@ function write_ws_xml_cols(ws, cols) {
o[o.length] = "</cols>";
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";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One-liners are the style of this project: but that is wrong and dangerous and hard to read. I am not a project owner, but this is something to consider.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain in your pull (now 2 years stale) what this does, exactly?

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 "";
Expand Down Expand Up @@ -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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does uncommenting this do?


if (ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols']));
o[sidx = o.length] = '<sheetData/>';
Expand Down