Save JQuery Handsontable to an excel file on server

此生再无相见时 提交于 2019-12-01 14:19:01

What your trying to do is certainly possible however there are a number of steps involved.

  • Handsontable seems to have a method called handsontable.getData().

You can see in the Load & Save example they use this method to 'get the data' from the handsontable and insert it into the ajax function.

  • Use a Ajax function to pass this data to a server side script.

Once your happy you can get the data, it needs to be passed to a server side script for further processing. This can be achieved using Ajax and POST or GET variables. For this step you can pretty much copy parts of their example. Otherwise Jquery has a nice Ajax function you could use.

  • Write a processing script to format the data in a CSV format and write it to a file.

Once you can confirm the data is getting to your server side script you need to encode it in a CSV format. Some server side languages have functions to help you do this. Once you have the data in the right format, you can write it to a file.

Keep in mind this wont produce a .xls file, it will make a .csv which is about as good as you will get with minimal fuss and will certainly be useful for people outside of the plugin. If you want to learn more about this sort of thing then you should take a look at submitting forms with ajax since this is essentially what your doing only more complex.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!