简体   繁体   English

将表格数据“ POST”到XLS / CSV

[英]“POST” form data to XLS/CSV

So I'm trying to essentially "POST" data from a form in an offline webpage, to an Excel spreadsheet, or CSV, or even just a TXT file. 因此,我实际上试图将数据从脱机网页中的表单“发布”到Excel电子表格或CSV,甚至只是TXT文件。 Now I have seen this to be possible using ActiveX in Internet Explorer, however, the methods I saw were pretty particular to the user's code, so I got a bit lost in translation being a beginner. 现在,我已经知道可以使用Internet Explorer中的ActiveX来实现这一点,但是,我所看到的方法对于用户的代码来说是相当特殊的,因此对于初学者来说,我在翻译中有些失落。 Also some recommended using an offline database using JS, but I'm not sure where to begin with that. 也有人建议使用使用JS的脱机数据库,但是我不确定从哪里开始。

Can anyone offer some insight on this? 谁能对此提供一些见识? Is it possible? 可能吗? What would be the best route to take? 最好的路线是什么?

There are many ways to accomplish this. 有很多方法可以完成此任务。 The best solution will be the one that suits your specific requirements. 最好的解决方案将是适合您特定要求的解决方案。 Obviously, creating a text/csv file is easier than creating an xls. 显然,创建文本/ csv文件比创建xls容易。 That said, the basic psuedo code is as follows: 也就是说,基本伪代码如下:

  1. Collect form data 收集表格数据

  2. Create (in-memory or temporary) file from collected form data. 根据收集的表单数据创建(内存中或临时的)文件。

  3. Return file as download to client, or just save to some location, OR (best option) insert a row into a database. 将文件作为下载返回给客户端,或者仅保存到某个位置,或者(最佳选择)将一行插入数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM