Skip to content
This repository was archived by the owner on Jul 25, 2021. It is now read-only.

Commit 24e9695

Browse files
Travis ClarkeTravis Clarke
authored andcommitted
v3.2.12 – add emptyCSS property to replace cells values with an empty string in the exported file
1 parent 0b27ef1 commit 24e9695

File tree

11 files changed

+50
-15
lines changed

11 files changed

+50
-15
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ $("table").tableExport({
103103
position: "bottom", // (top, bottom), position of the caption element relative to table
104104
ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file
105105
ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file
106-
ignoreCSS: ".tableexport-ignore" // (selector, selector[]), selector(s) to exclude from the exported file
106+
ignoreCSS: ".tableexport-ignore" // (selector, selector[]), selector(s) to exclude cells from the exported file
107+
emptyCSS: ".tableexport-empty" // (selector, selector[]), selector(s) to replace cells with an empty string in the exported file
107108
});
108109
```
109110
> **Note:** to use the xlsx filetype, you must include the third-party scripts listed in the Dependencies section.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tableexport.js",
3-
"version": "3.2.11",
3+
"version": "3.2.12",
44
"authors": [
55
"clarketm <travis.m.clarke@gmail.com>"
66
],

dist/css/tableexport.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* TableExport.js v3.2.11 (https://www.travismclarke.com)
2+
* TableExport.js v3.2.12 (https://www.travismclarke.com)
33
* Copyright 2016 Travis Clarke
44
* Licensed under the MIT license
55
*/

dist/css/tableexport.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/tableexport.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* TableExport.js v3.2.11 (https://www.travismclarke.com)
2+
* TableExport.js v3.2.12 (https://www.travismclarke.com)
33
* Copyright 2016 Travis Clarke
44
* Licensed under the MIT license
55
*/
@@ -41,6 +41,7 @@
4141
ignoreRows = self.settings.ignoreRows instanceof Array ? self.settings.ignoreRows : [self.settings.ignoreRows],
4242
ignoreCols = self.settings.ignoreCols instanceof Array ? self.settings.ignoreCols : [self.settings.ignoreCols],
4343
ignoreCSS = self.settings.ignoreCSS instanceof Array ? self.settings.ignoreCSS.join(", ") : self.settings.ignoreCSS,
44+
emptyCSS = self.settings.emptyCSS instanceof Array ? self.settings.emptyCSS.join(", ") : self.settings.emptyCSS,
4445
bootstrapClass, bootstrapTheme, bootstrapSpacing;
4546

4647
if (self.settings.bootstrap) {
@@ -74,6 +75,9 @@
7475
if (!!~ignoreCols.indexOf(ic) || $(val).is(ignoreCSS)) {
7576
return;
7677
}
78+
if ($(val).is(emptyCSS)) {
79+
return " "
80+
}
7781
if (val.hasAttribute('colspan')) {
7882
rcMap[ir] = rcMap[ir] || {};
7983
rcMap[ir][ic+1] = val.getAttribute('colspan') - 1
@@ -112,6 +116,9 @@
112116
if (!!~ignoreCols.indexOf(ic) || $(val).is(ignoreCSS)) {
113117
return;
114118
}
119+
if ($(val).is(emptyCSS)) {
120+
return " "
121+
}
115122
if (val.hasAttribute('colspan')) {
116123
rcMap[ir] = rcMap[ir] || {};
117124
rcMap[ir][ic+1] = val.getAttribute('colspan') - 1
@@ -150,6 +157,9 @@
150157
if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) {
151158
return;
152159
}
160+
if ($(val).is(emptyCSS)) {
161+
return " "
162+
}
153163
return $(val).text();
154164
}).get().join(colD);
155165
}).get().join(rdel),
@@ -175,6 +185,9 @@
175185
if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) {
176186
return;
177187
}
188+
if ($(val).is(emptyCSS)) {
189+
return " "
190+
}
178191
return $(val).text();
179192
}).get().join(colD);
180193
}).get().join(rdel),
@@ -200,6 +213,9 @@
200213
if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) {
201214
return;
202215
}
216+
if ($(val).is(emptyCSS)) {
217+
return " "
218+
}
203219
return $(val).text();
204220
}).get().join(colD);
205221
}).get().join(rdel),
@@ -264,7 +280,8 @@
264280
position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom")
265281
ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null)
266282
ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file (default: null)
267-
ignoreCSS: ".tableexport-ignore" // (selector, selector[]), selector(s) to exclude from the exported file (default: ".tableexport-ignore")
283+
ignoreCSS: ".tableexport-ignore", // (selector, selector[]), selector(s) to exclude cells from the exported file (default: ".tableexport-ignore")
284+
emptyCSS: ".tableexport-empty" // (selector, selector[]), selector(s) to replace cells with an empty string in the exported file (default: ".tableexport-empty")
268285
},
269286
/**
270287
* Character set (character encoding) of the HTML.

0 commit comments

Comments
 (0)