A free open source IT asset/license management system
Fixed weird escaping in BS table export when text is hyperlinked
snipe371d44b2a702
diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex bb416747fa..98d821e34f 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -500,6 +500,20 @@// textarea fields survive HTML-stripping during exportreturn htmlData.replace(/<br\s*\/?>/gi, '\n');}+ // Escape double quotes in hyperlink href and display text so that+ // Excel HYPERLINK formulas are not corrupted when values contain "+ export_options['mso'] = {+ xlsx: {+ onHyperlink: function (cell, row, col, href, cellText, formula) {+ var escapedHref = href.replace(/"/g, '""');+ var escapedText = cellText.replace(/"/g, '""');+ if (escapedText.length) {+ return '=HYPERLINK("' + escapedHref + '","' + escapedText + '")';+ }+ return '=HYPERLINK("' + escapedHref + '")';+ }+ }+ };// This allows us to override the table defaults set below using the data-dash attributesvar table = this;