Excel Export Datatable - string starts with a '

Hi,

when doing a webix.toExcel
with templates in the export fields like

                        "finanzen_rechnungen_overview_summenetto": {
                            template: function(obj) {
                                return webix.i18n.numberFormat(obj.finanzen_rechnungen_overview_summenetto);
                            }
                        },

the exported excel file starts in that column field with a ’ in every row…

Any way to fix that?

Thanks,
Martin

you can see that here:
http://webix.com/snippet/1819c6e8

check in the exported xls-file the year column. Each row starts with a ’

Thanks,
Martin

Hi,

The problem is that Excel considers such formatted numbers as numeric values. At the same time during export the cells for such numbers are tuned to contain string values, as the numberFormat returns formatted strings.

That’s why Excel appends a warning (’) sign for such cells.

The only way to fix it now is to export unformatted numbers. We may consider adding a possibility to set cell datatype of a particular column explicitly.

Hi Helga,

but how can this be achieved, if I have a template in database column?

Thanks,
Martin

If the numbers come as strings from the database, you can convert them to numbers in the datatable scheme:

$init:function(obj){
     obj.votes =  parseFloat(obj.votes.replace(",", ""));
}

http://webix.com/snippet/cc3bb2f1