Skip to content

Commit a806ee9

Browse files
author
hhurz
committed
New option 'exportHiddenCells' to speed up export of large tables with hidden cells
1 parent c637903 commit a806ee9

File tree

3 files changed

+82
-72
lines changed

3 files changed

+82
-72
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ escape: false
145145
excelRTL: false
146146
excelstyles: []
147147
excelFileFormat: 'xlshtml'
148+
exportHiddenCells: false
148149
fileName: 'tableExport'
149150
htmlContent: false
150151
ignoreColumn: []

tableExport.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
excelFileFormat: 'xlshtml', // xmlss = XML Spreadsheet 2003 file format (XMLSS), xlshtml = Excel 2000 html format
2424
excelRTL: false, // true = Set Excel option 'DisplayRightToLeft'
2525
excelstyles: [], // e.g. ['border-bottom', 'border-top', 'border-left', 'border-right']
26+
exportHiddenCells: false, // true = speed up export of large tables with hidden cells (hidden cells will be exported !)
2627
fileName: 'tableExport',
2728
htmlContent: false,
2829
ignoreColumn: [],
@@ -109,7 +110,7 @@
109110
var ranges = [];
110111
var blob;
111112
var $hiddenTableElements = [];
112-
var checkCellVisibilty = false; // used to speed up export of tables with extensive css styling
113+
var checkCellVisibilty = false;
113114

114115
$.extend(true, defaults, options);
115116

@@ -414,8 +415,10 @@
414415

415416
docNames.push($('<div />').text(ssName).html());
416417

417-
$hiddenTableElements = $table.find("tr, th, td").filter(":hidden");
418-
checkCellVisibilty = $hiddenTableElements.length > 0;
418+
if ( defaults.exportHiddenCells === false ) {
419+
$hiddenTableElements = $table.find("tr, th, td").filter(":hidden");
420+
checkCellVisibilty = $hiddenTableElements.length > 0;
421+
}
419422

420423
rowIndex = 0;
421424
colNames = GetColumnNames(this);
@@ -622,8 +625,10 @@
622625
docName = docName.replace(/[\\\/[\]*:?'"]/g, '').substring(0, 31).trim();
623626
}
624627

625-
$hiddenTableElements = $table.find("tr, th, td").filter(":hidden");
626-
checkCellVisibilty = $hiddenTableElements.length > 0;
628+
if ( defaults.exportHiddenCells === false ) {
629+
$hiddenTableElements = $table.find("tr, th, td").filter(":hidden");
630+
checkCellVisibilty = $hiddenTableElements.length > 0;
631+
}
627632

628633
rowIndex = 0;
629634
ranges = [];
@@ -1075,8 +1080,10 @@
10751080
var rowCount = 0;
10761081
ranges = [];
10771082

1078-
$hiddenTableElements = $(this).find("tr, th, td").filter(":hidden");
1079-
checkCellVisibilty = $hiddenTableElements.length > 0;
1083+
if ( defaults.exportHiddenCells === false ) {
1084+
$hiddenTableElements = $(this).find("tr, th, td").filter(":hidden");
1085+
checkCellVisibilty = $hiddenTableElements.length > 0;
1086+
}
10801087

10811088
$hrows = $(this).find('thead').find(defaults.theadSelector);
10821089
$rows = collectRows ($(this));
@@ -1106,8 +1113,10 @@
11061113
rowIndex = 0;
11071114
ranges = [];
11081115

1109-
$hiddenTableElements = $(this).find("tr, th, td").filter(":hidden");
1110-
checkCellVisibilty = $hiddenTableElements.length > 0;
1116+
if ( defaults.exportHiddenCells === false ) {
1117+
$hiddenTableElements = $(this).find("tr, th, td").filter(":hidden");
1118+
checkCellVisibilty = $hiddenTableElements.length > 0;
1119+
}
11111120

11121121
colNames = GetColumnNames(this);
11131122

0 commit comments

Comments
 (0)