I am continuing from my previous question I need a way to export my json string into a xls or csv file that can be opened in MS Excel (I am using simple html and jsp).
So far I found this link that made me open a excel using
var xls = new ActiveXObject("Excel.Application");
xls.visible = true;
Any type of suggestions is welcome. Thankyou
I’m not familiar with xls format so I can’t give a code example, but you can use
handlebars.jshttp://www.handlebarsjs.com/ which is a small and simple json -> xml templating engine.EDIT:
I was under the false impression that xls files were xml. So unless excel has the ability to import xml, you should create the xls server-side with something like this http://pizzaseo.com/php-excel-creator-class. You can do with with ajax to make it transparent to the user.
EDIT:
Excel can import xml files so you can use handlbars.js http://www.handlebarsjs.com/ to easily convert json to xml. However if that’s not an option, you should look into POI http://poi.apache.org/ which is a JAVA api for Microsoft documents.