Leading Zeros when export to Excel

I have a grid column with numeric values with leading zeros, but when exporting to excel, excel formats the cell to general and removes the leading zero.

Is there a way to stop this?

Could you provide initialization code or link to your grid?
I tried to do the same locally with column which has ‘str’ type.
It works properly.

Here is my init code

mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath("/dhtmlx_2.6/std/imgs/");

mygrid.setHeader(“Title,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan”);
mygrid.attachHeader(“Quote #,Telephone,Mobile,Shed Type,Quote $,Contract $,Quote Date”);
mygrid.setColSorting(“str,str,str,str,str,str,str”);
mygrid.setInitWidths(",,,,,,,");
mygrid.setColTypes(“ro,ro,ro,ro,price,price,ro”);

mygrid.init();
mygrid.loadXML(‘test.xml’);

here is a snip of my xml

QHU2963 0431000000 GARAGE 1907 2011-06-27

Hi.
Please, open gridExcelGenerator.php and modify it like here:

$columnArr['excel_type'] = (isset($column->attributes()->excel_type)) ? trim((String) $column->attributes()->excel_type) : "str";

Be attentive, there are two such occurences in this file. You should replace both.

My gridExcelGenerator.php does not contain any line starting with
$columnArr[‘excel_type’]

Make sure you’re using the last version of export tool:
dhtmlx.com/x/download/regula … 100909.zip

Working!

Thanks