Declined
Last Updated: 20 Sep 2024 07:17 by ADMIN
AGB
Created on: 13 Sep 2024 09:57
Category: Kendo UI for jQuery
Type: Bug Report
0
Grid Excel Export - Title data not being unescaped
Hi Guys,

Have just tripped over the following whereby html escaped title data is being shown in the Excel column headers when the grid is exported to Excel.

To illustrate the problem run the following dojo

    https://dojo.telerik.com/AwUMarUl

As you can see the first column title is not shown due to the angled brackets
The second column has the angled brackets escaped so the title shows correctly in the grid.

Now when the grid is exported the column headings are as follows:

    <Product Name>  &lt;Unit Price&gt;

which is not what is expected ... Any & all html escaped characters should be un-escaped.

Regards
Alan


1 comment
ADMIN
Neli
Posted on: 20 Sep 2024 07:17

Hi Alan,

Please note that the Grid does not support the export of arbitrary Html to Excel. This limitation is mentioned in the Known Limitations section of the documentation. Excel itself does not support displaying arbitrary HTML so the way the the data is visualized in the Grid is different that the way Excel will show that data. 

Whether the configured title in the Grid will be displayed encoded could be controlled through the encodeTitles option. However, the titles of the Grid columns will be exported as is to the Excel file. If you need to unescape the configured titles string you could handle the exportExcel event and modify the titles:

excelExport: function(e) {
            var sheet = e.workbook.sheets[0];
            var cells = sheet.rows[0].cells;

            for(var i=0; i < cells.length; i++){
              if(sheet.rows[0].cells[i].value){
                sheet.rows[0].cells[i].value = htmlDecode(sheet.rows[0].cells[i].value)
              }              
            }
          },

Here is such Dojo example - https://dojo.telerik.com/@NeliK/epexUkoz.

As the observed behavior is expected I am changing the status of the item to 'Declined'. In case you have any additional quetsions do not hesitate to contact us.

I hope you will find the provided information helpful. 

 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.