Skip to content

Commit

Permalink
change regex to remove only HTML bold tags
Browse files Browse the repository at this point in the history
  • Loading branch information
OS-giulianasilva committed Feb 5, 2025
1 parent e9fa2cf commit 97e6e7a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Providers/DataGrid/Wijmo/Features/Export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ namespace Providers.DataGrid.Wijmo.Feature {
}

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

public build(): void {
Expand Down Expand Up @@ -107,7 +107,12 @@ namespace Providers.DataGrid.Wijmo.Feature {
this._resetPagination();

const params = { fileName: this._handleFilename(filename, true) };
const result = this._stripHtmlTags(this._grid.provider.getClipString(this._getFullCellRange(), true, true));
let result = this._grid.provider.getClipString(this._getFullCellRange(), true, true);

// Remove text bold tags only when the grid is grouped
if (this._grid.features.groupPanel.isGridGrouped) {
result = this._stripHtmlBoldTag(result);
}

this._reApplyPagination();
wijmo.saveFile(result, params.fileName);
Expand Down

0 comments on commit 97e6e7a

Please sign in to comment.