webix Export toExcel customizing data

106 views Asked by At

I tried this code in webix

  webix.toExcel($$("datatableTab"), {
    filename: "Data_Diff",
    name: "Name"
  });

and it dumped everything in my datatable (datatableTab). But in certain cells I have data like

"<span style='color:blue;'>00000000</span><span style='color:LimeGreen;'>000300EE</span>"

Which I want it to be LHS:00000000,RHS:000300EE

I tried this

filterHTML:true 

and it too printed in Excel as 00000000000300EE

How do I customize my Excel cell output?

Links I refered:

1

There are 1 answers

0
kuro no fukkatsu On

I think you should try the columns.template setting:

webix.toExcel($$("myDataTable"), {
    columns:{
        "title":{
            template: obj => { /* your code here */ }
        },
    }
});

In there, use const htmlFilter = /<[^>]*>/gi; to replace tags with something you need to show instead (or just remove them) and also find and display non-HTML strings in the way that you need. E.g. https://snippet.webix.com/j5vm2f39