ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on January 08, 2018, 01:52:50 pm

Title: HTML in column header
Post by: queensgambit9 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?

Title: Re: HTML in column header
Post by: paramvir on January 09, 2018, 02:09:48 pm
There is no direct option to exclude it.

Looking into alternative ways to do that.
Title: Re: HTML in column header
Post by: paramvir 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
Title: Re: HTML in column header
Post by: queensgambit9 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?
Title: Re: HTML in column header
Post by: paramvir on January 09, 2018, 09:42:26 pm
The above mentioned solution is for you.
Title: Re: HTML in column header
Post by: queensgambit9 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...
Title: Re: HTML in column header
Post by: paramvir 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.
Title: Re: HTML in column header
Post by: queensgambit9 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.