jsPDF-AutoTable icon indicating copy to clipboard operation
jsPDF-AutoTable copied to clipboard

useCss individual column styles bug

Open RileyDavidson-Evans opened this issue 7 years ago • 5 comments

Hey so loving the package ! One thing I am noticing is that when using the useCss flag, not all columns styles are respected. It seems to add combine all individual column styles and apply to each column of the row ?

for example if I have a row where the first column's background is explicitly set to blue, and no other columns have the background color. When printing all of the columns now have the background of blue.

RileyDavidson-Evans avatar Jan 28 '19 14:01 RileyDavidson-Evans

from debugging it seems like this line which combines the styles is causing individual column styling to be over ridden styles: useCss ? polyfills_1.assign(rowStyles, cellStyles) : null, in -> parseTableSection

RileyDavidson-Evans avatar Jan 28 '19 14:01 RileyDavidson-Evans

@simonbengtsson I'm noticing that in this code here

for (let i = 0; i < row.cells.length; i++) {
      let cell = row.cells[i];
      let style = window.getComputedStyle(cell);
      if (includeHidden || style.display !== "none") {
        let cellStyles = useCss ? parseCss(cell, state().scaleFactor()) : {};
        resultRow.push({
          rowSpan: cell.rowSpan,
          colSpan: cell.colSpan,
          styles: useCss ? assign(rowStyles, cellStyles) : null,
          content: cell
        });
      }
    }

the style variable let style = window.getComputedStyle(cell); is never used ?

RileyDavidson-Evans avatar Jan 29 '19 16:01 RileyDavidson-Evans

#439

RileyDavidson-Evans avatar Jan 29 '19 21:01 RileyDavidson-Evans

👍

RileyDavidson-Evans avatar Jan 29 '19 21:01 RileyDavidson-Evans

Fix included in 3.0.5

simonbengtsson avatar Jan 29 '19 21:01 simonbengtsson