Skip to content

Commit 97e6e7a

Browse files
change regex to remove only HTML bold tags
1 parent e9fa2cf commit 97e6e7a

File tree

1 file changed

+8
-3
lines changed
  • src/Providers/DataGrid/Wijmo/Features

1 file changed

+8
-3
lines changed

src/Providers/DataGrid/Wijmo/Features/Export.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ namespace Providers.DataGrid.Wijmo.Feature {
5959
}
6060

6161
// Workaround for HTML tags being exported in CSV with Grouped Columns
62-
private _stripHtmlTags(htmlString: string): string {
62+
private _stripHtmlBoldTag(htmlString: string): string {
6363
if (!htmlString) return '';
64-
return htmlString.replace(/<(?!>)[a-zA-Z0-9/][^>]*>/g, '');
64+
return htmlString.replace(/<b>|<\/b>/g, '');
6565
}
6666

6767
public build(): void {
@@ -107,7 +107,12 @@ namespace Providers.DataGrid.Wijmo.Feature {
107107
this._resetPagination();
108108

109109
const params = { fileName: this._handleFilename(filename, true) };
110-
const result = this._stripHtmlTags(this._grid.provider.getClipString(this._getFullCellRange(), true, true));
110+
let result = this._grid.provider.getClipString(this._getFullCellRange(), true, true);
111+
112+
// Remove text bold tags only when the grid is grouped
113+
if (this._grid.features.groupPanel.isGridGrouped) {
114+
result = this._stripHtmlBoldTag(result);
115+
}
111116

112117
this._reApplyPagination();
113118
wijmo.saveFile(result, params.fileName);

0 commit comments

Comments
 (0)