html2canvas-pro icon indicating copy to clipboard operation
html2canvas-pro copied to clipboard

When exporting a table to an image, there is a small issue with handling the style of merged row headers.

Open shalousun opened this issue 11 months ago • 1 comments

Below is my original HTML table.

Image

Then, I use the following code to export the table to an image:

document.getElementById("download-button").addEventListener("click", function () {
    const table = document.getElementById("summary-table");
    html2canvas(table).then(function (canvas) {
      // Convert the canvas to an image and save it
      const img = canvas.toDataURL("image/png");
      const a = document.createElement('a');
      a.href = img;
      a.download = "summary-report.png"; // Set the download file name
      a.click();
    });
});

The exported image is displayed as follows:

Image

shalousun avatar Mar 09 '25 14:03 shalousun

Below is my original HTML table.

Image Then, I use the following code to export the table to an image:

document.getElementById("download-button").addEventListener("click", function () { const table = document.getElementById("summary-table"); html2canvas(table).then(function (canvas) { // Convert the canvas to an image and save it const img = canvas.toDataURL("image/png"); const a = document.createElement('a'); a.href = img; a.download = "summary-report.png"; // Set the download file name a.click(); }); }); The exported image is displayed as follows:

Image

try to use this REPO fix all 🐞:https://github.com/qq15725/modern-screenshot

learner-dhx avatar Jun 19 '25 09:06 learner-dhx