Skip to content

Commit

Permalink
According to rstudio#418, improve buttons.html5.min.js. This builds o…
Browse files Browse the repository at this point in the history
…n commit ed15f2f improves the outputfunction excelHtml5 to export excel files with multi-row headers, without the merges. On top of what is described  rstudio#418, it makes other modifications needed to match the latest rstudio/DT version.
  • Loading branch information
mtyszler committed Jan 5, 2020
1 parent bfa1548 commit 6b56d58
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
}

function K(a, b) {
var d =
a.header[b].length,
c;
//var d = a.header[b].length
for (var d = 0, o = 0; o<a.header.length; o++) d = Math.max(d, a.header[o][b].length); // gets the largest width of column b
var c;
a.footer && a.footer[b].length > d && (d = a.footer[b].length);
for (var f = 0, g = a.body.length; f < g; f++)
if (c = a.body[f][b], c = null !== c && c !== s ? c.toString() : "", -1 !== c.indexOf("\n") ? (c = c.split("\n"), c.sort(function(a, c) {
Expand Down Expand Up @@ -441,17 +441,27 @@
i("row:eq(" + (a - 1) + ") c", e).attr("s", "51")
},
p = b.buttons.exportInfo(c);
p.title && (r([p.title], g), k(g, d.header.length - 1));
p.title && (r([p.title], g), k(g, /*d.header.length*/ d.header[d.header.length - 1].length - 1));
p.messageTop && (r([p.messageTop],
g), k(g, d.header.length - 1));
c.header && (r(d.header, g), i("row:last c", e).attr("s", "2"));
g), k(g, /*d.header.length*/ d.header[d.header.length - 1].length - 1));
/* ----- BEGIN added Code ----- */
//c.header && (r(d.header, g), i("row:last c", e).attr("s", "2"));

if(c.header){
for (o = 0; o < d.header.length; o++){
r(d.header[o], g);
i("row:last c", e).attr("s", "2");
}
}

/*END added code*/
for (var o = 0, u = d.body.length; o < u; o++) r(d.body[o], g);
c.footer && d.footer && (r(d.footer, g), i("row:last c", e).attr("s", "2"));
p.messageBottom && (r([p.messageBottom], g), k(g, d.header.length - 1));
p.messageBottom && (r([p.messageBottom], g), k(g, /*d.header.length*/d.header[d.header.length - 1].length - 1));
r = q(e, "cols");
i("worksheet", e).prepend(r);
k = 0;
for (o = d.header.length; k < o; k++) r.appendChild(q(e, "col", {
for (o = /*d.header.length*/d.header[d.header.length - 1].length; k < o; k++) r.appendChild(q(e, "col", {
attr: {
min: k + 1,
max: k + 1,
Expand Down

0 comments on commit 6b56d58

Please sign in to comment.