Export Excel button Edit body option display html tags

Export Excel button Edit body option display html tags

pooja.kapasipooja.kapasi Posts: 3Questions: 1Answers: 0

its a vert nice & easy to use datatables.

When I m using export option with edit body option is display HTML tags in my excel sheet, is there any solution?

kindly guide me.

thank you in advance.

Answers

  • pooja.kapasipooja.kapasi Posts: 3Questions: 1Answers: 0

    ::: Find my code for your reference the same :::

    var buttonCommon = {
    exportOptions: {
    format: {
    body: function (data, row, column, node) {
    return column === 5 ? data.replace(/[.]/g, '') : data;

                        }
                    }
                }
            };
           var datatables =  $('#<%=gvdetail.ClientID%>').DataTable({
                "scrollX": true,
                "scrollY": "300px",
                "paging": false,
                "header": true,
                "footer": true,
                "bInfo": false,
                "dom": 'Bfrtip',
                buttons: [
                    {
                         extend: 'excel',
                         text: 'Export to excel',
                         title: 'PMS as on ' + currdate,
                         footer: true,
                         stripHtml: false,
                         decodeEntities: true,
                         columns: ':visible',
                         modifier: {
                             selected: true
                         },
                         exportOptions: {
                             format: {
                                 body: function (data, row, column, node) {
    
                                     return column === 5 ?
                                         data.replace(/[.]/g, 'pooja') :
                                         data;
                                 }
                             }
                         }
                     },
                      {
                          extend: 'pdfHtml5',
                          footer: true,
                          exportOptions: {
    
                              modifier: {
                                  page: 'current'
                              }, 
                          },
                          header: true,
                          title: 'PMS as on ' + currdate,
                          orientation: 'landscape',
                          customize: function (doc) {
                              doc.defaultStyle.fontSize = 10;
                              doc.content.splice(1, 0, {
                                  margin: [0, -50, 0, 5],
                                  alignment: 'left',
                                  image: imgs
                              });
                          },
                          text: 'Export to pdf',
                      },
                      {
                          extend: 'colvis',
                          text: 'Show/hide Columns',
                      }
                ]
            });
    
This discussion has been closed.