I have created tag in the data grid's column using html & CSS.
When using the data grid function for exporting to excel, it will displayed the line of html code...
How can I export to excel without the html code, but only show On Time, Pending, Overdue & Late submission in the excel??
Thank you
Hi @JWLoo
When assigning the value to the Excel structure, you can extract the status name by following this approach:
Separating StartIndex and EndIndex can help with readability and debugging. However, if you prefer, you can also handle this in a single line of code.
Hope this solves your problem! Reply if you need help to understand this.
AC
Hi @André Costa, thank you. But if I'm using the data grid's built-in export to excel function with java script, then where can put the logic that u suggested?
Java script:
You can include the logic in the flow right before saving the data.
If you need more specific information, please share your oml, so I can assist you
Hi @JWLoo,You can create a Server Action in OutSystems to remove HTML tags from text. Here is a simple example using the regex replace function
Server action: StripHtmlTags
Input: HtmlText(text) .
Output: CleanText(text) .
CleanText = Regex_Replace(HtmlText, "<[^>]*(>|$)", "", RegexOptions.IgnoreEntry|RegexOptions.Multiline);
This function can be called before the export data is loaded into Excel to remove any HTML tags.
Thanks,
Vipin Yadav
Hi @Vipin Yadav, thanks for replying me. But if I'm using the data grid built-in export to excel function with java script, then where can I place this StripHtmlTags server action?
Hello @JWLoo ,
I would like to suggest to please share the OML file of your application so that community members can easily help you.
Thanks
Regards Gourav Shrivastava
can you try loading this js script into your application?
<script src="https://cdn.jsdelivr.net/npm/ag-grid-enterprise/dist/ag-grid-enterprise.min.js"></script>
and then try using this function
gridOptions.api.exportDataAsExcel();
Regards.
Hi Eveyone,
I'm facing the same issue, do we have any inputs on thisp. Avoid html while exporting the grid data using default data grid export using Javascript.
Hello @JWLoo & @Sudharshan T
I had the same requirement for the status column, and this script resolved my issue. Just follow these steps:
1. Create JavaScript in app with JS
line no 10 has colSpan condition just in case you are using that column in grouping
2. Then add that created script in block/screen of grid as required scripts
3. On click of export user JS
Hello @JWLoo,
To make this more collaborative and to make sure the community is looking into the same use case that you're reporting, please share a sample oml where that can be reproduced and please indicate the steps to reproduce the scenario you mentioned (include a GIF/video if it's easier).
Cheers,GM