|
Lines 428-433
function _dt_buttons(params) {
Link Here
|
| 428 |
}, |
428 |
}, |
| 429 |
}; |
429 |
}; |
| 430 |
|
430 |
|
|
|
431 |
const export_format_spreadsheet = { |
| 432 |
body: function (data, row, column, node) { |
| 433 |
const newnode = node.cloneNode(true); |
| 434 |
const no_export_nodes = newnode.querySelectorAll(".no-export"); |
| 435 |
no_export_nodes.forEach(child => { |
| 436 |
child.parentNode.removeChild(child); |
| 437 |
}); |
| 438 |
//Note: innerHTML is the same thing as the data variable, |
| 439 |
//minus the ".no-export" nodes that we've removed |
| 440 |
//Note: See dataTables.buttons.js for original function usage |
| 441 |
let str = DataTable.Buttons.stripData(newnode.innerHTML, { |
| 442 |
decodeEntities: false, |
| 443 |
stripHtml: true, |
| 444 |
stripNewlines: true, |
| 445 |
trim: true, |
| 446 |
escapeExcelFormula: true, |
| 447 |
}); |
| 448 |
//Note: escapeExcelFormula only works from Buttons 3.2.0+, so |
| 449 |
//we add a workaround for now |
| 450 |
const unsafeCharacters = /^[=+\-@\t\r]/; |
| 451 |
if (unsafeCharacters.test(str)) { |
| 452 |
str = "'" + str; |
| 453 |
} |
| 454 |
return str; |
| 455 |
}, |
| 456 |
}; |
| 457 |
|
| 431 |
var export_buttons = [ |
458 |
var export_buttons = [ |
| 432 |
{ |
459 |
{ |
| 433 |
extend: "excelHtml5", |
460 |
extend: "excelHtml5", |
|
Lines 479-485
function _dt_buttons(params) {
Link Here
|
| 479 |
text: __("CSV"), |
506 |
text: __("CSV"), |
| 480 |
exportOptions: { |
507 |
exportOptions: { |
| 481 |
columns: exportColumns, |
508 |
columns: exportColumns, |
| 482 |
format: export_format, |
509 |
format: export_format_spreadsheet, |
| 483 |
}, |
510 |
}, |
| 484 |
}, |
511 |
}, |
| 485 |
{ |
512 |
{ |
| 486 |
- |
|
|