Author Topic: HTML in column header  (Read 3428 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
HTML in column header
« on: January 08, 2018, 01:52:50 pm »
Is it possible to have HTML in column header (in title) which does not get included when exporting?

« Last Edit: January 08, 2018, 01:55:16 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: HTML in column header
« Reply #1 on: January 09, 2018, 02:09:48 pm »
There is no direct option to exclude it.

Looking into alternative ways to do that.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: HTML in column header
« Reply #2 on: January 09, 2018, 02:45:12 pm »
Theoretically anything is possible with help of powerful js workbook :) as it gives access to low level structure of the worksheet.

Code: [Select]
        listener: function() {
          var w = this.exportData({
            format: 'xlsx',
            workbook: true
          });

          //clean all cells in first row. 
          pq.excel.eachCell([w.sheets[0].rows[0]], function(cell) {
            cell.value = cell.value.replace(/<.*?>/g, "")
          })
         
          var blob = pq.excel.exportWb({
            workbook: w,
            type: 'blob'
          });
          saveAs(blob, "pqGrid.xlsx");
        }

Please check this example to remove html from ProductID header cell.

https://plnkr.co/edit/VCU57nr1hmtCGx7no8cG?p=preview

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: HTML in column header
« Reply #3 on: January 09, 2018, 09:36:29 pm »
Thanks.
I am also using HTML in grid title, which gives issues when exporting to Excel.
Possible to solve aswell?
« Last Edit: January 09, 2018, 09:54:35 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: HTML in column header
« Reply #4 on: January 09, 2018, 09:42:26 pm »
The above mentioned solution is for you.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: HTML in column header
« Reply #5 on: January 09, 2018, 10:19:32 pm »
Not sure I follow...the grid title is not in the cells, but gives error message when opening the exported file...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: HTML in column header
« Reply #6 on: January 09, 2018, 10:41:59 pm »
Please make changes in the above plnkr to reproduce the error so that I can look into it.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: HTML in column header
« Reply #7 on: January 10, 2018, 02:01:59 pm »
Couldn't recreate in your code.
Solved by setting option sheetName, seems name used from title caused some error when using HTML.
Thanks.