Skip to content

Commit

Permalink
fix(analytics): preserve whitespace for exports
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz committed Nov 8, 2024
1 parent fcfdede commit 6829edf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/analytics/addon/components/ca-report-preview.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
{{#each this.data.value.fields as |row|}}
<tr>
{{#each row as |entry|}}
<td data-t={{this.getXLSXType entry.value}}>
<td
data-t={{this.getXLSXType entry.value}}
data-v={{this.cleanValue entry.value}}
>
{{entry.value}}
</td>
{{/each}}
Expand All @@ -39,7 +42,10 @@
{{#if this.data.value.summary}}
<tr class="uk-text-bold">
{{#each this.data.value.summary as |summary|}}
<td data-t={{this.getXLSXType summary.value}}>
<td
data-t={{this.getXLSXType summary.value}}
data-v={{this.cleanValue summary.value}}
>
{{summary.value}}
</td>
{{/each}}
Expand Down
3 changes: 3 additions & 0 deletions packages/analytics/addon/components/ca-report-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@ export default class CaReportPreviewComponent extends Component {
// Default to string
return "s";
}

// cleaning needed because excel does not support carriage returns
cleanValue = (value) => value?.replaceAll(/\r/g, "");
}

0 comments on commit 6829edf

Please sign in to comment.