Skip to content

Commit

Permalink
fix for issue kayalshri#22
Browse files Browse the repository at this point in the history
Data shift with PDF + data-tableexport-display="none"
  • Loading branch information
hhurz committed Jun 30, 2015
1 parent e3bbbb9 commit 548efc8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
13 changes: 8 additions & 5 deletions tableExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,18 +501,21 @@ THE SOFTWARE.*/
atOptions.renderCell = function (x, y, width, height, key, value, row, settings)
{
var doc = settings.tableExport.doc;
var col = settings.tableExport.columns [key];
var xoffset = 0;

doc.setFillColor(row % 2 === 0 ? 245 : 255);
doc.setTextColor(50);
doc.rect(x, y, width, height, 'F');
y += settings.lineHeight / 2 + doc.autoTableTextHeight() / 2 - 2.5;

if (col.style.align == 'right')
xoffset = width - doc.getStringUnitWidth((''+value)) * doc.internal.getFontSize() - settings.padding;
else if (col.style.align == 'center')
xoffset = (width - doc.getStringUnitWidth((''+value)) * doc.internal.getFontSize()) / 2;
if (typeof settings.tableExport.columns [key] != 'undefined') {
var col = settings.tableExport.columns [key];

if (col.style.align == 'right')
xoffset = width - doc.getStringUnitWidth((''+value)) * doc.internal.getFontSize() - settings.padding;
else if (col.style.align == 'center')
xoffset = (width - doc.getStringUnitWidth((''+value)) * doc.internal.getFontSize()) / 2;
}

if (xoffset < settings.padding)
xoffset = settings.padding;
Expand Down
Loading

0 comments on commit 548efc8

Please sign in to comment.