Recently, we had a customer ask an interesting question:

  • Export Issue  :I have seen your blog post for generating Excel version  2007 xml files. I need something which work with .xls file not xml files. Also, column having numbers are converted to scientific notation..I am Ok if it exported as strings
Answer: The bottom line is that currently we cannot generate pure XLS files completely on the client. What we can do is emulate HTML in Excel. If you do  grid.excelOptions.useExcelExporter=true; It will generate an xls, and excel will be able to open it. 

Another important point to note is that we cannot control how excel displays numbers. What we can do, is define a label function that concatenates the data with blank strings.

Some thing like

var excelIssueBypass=function(item,col){
return item[col.getDataField()] + " ";//just so excel does not apply scientific notation
}

Both these concepts are demonstrated in the attahed sample code.. 


 

ExcelExporter.html (3.49 kb)