简体   繁体   English

在 Web 应用程序中显示 Excel 表格并即时提供编辑功能

[英]displaying excel sheet in web application and providing edit feature on the fly

I do not have the option of using iFrame for displaying excel sheet in web app as the excel sheet is fetched from the database and differs for each person logged in. Hence the excel sheet can neither be uploaded to onedrive or google drive.我没有使用 iFrame 在网络应用程序中显示 excel 表的选项,因为 excel 表是从数据库中获取的,并且每个登录的人都不同。因此,excel 表既不能上传到 onedrive 也不能上传到谷歌驱动器。 Oh and also its a JSP Servlets web app so am a bit tied there as well.哦,它也是一个 JSP Servlets web 应用程序,所以我也有点依赖。

While I saw there are various plugins available, my head has been spinning from the google results , the best I could think of ..was to create and editable table out of the excel sheet.虽然我看到有各种可用的插件,但我的头脑一直在从谷歌结果中旋转,我能想到的最好的..是从 Excel 表中创建和可编辑的表格。

To elaborate my requirement, this is the flow I want to achieve, implementation is big question mark!!详细说明我的需求,这就是我要实现的流程,实现是个大问号!!

  1. Read excel sheet from DB (this has already been uploaded by user in another form)从数据库读取excel表(这已经由用户以另一种形式上传)
  2. Allow user to view and edit this sheet on another form允许用户在另一个表单上查看和编辑此工作表
  3. Submit button on 2nd form picks the changed sheet data as a binary stream and invokes REST API which then does something with this sheet.第二个表单上的提交按钮将更改的工作表数据选择为二进制流,并调用 REST API,然后使用该工作表执行某些操作。

I saw Jexcel as an option but do not know how to import excel data into it, I guess any other good jquery plugin could also help, only am short of time in researching我看到 Jexcel 作为一个选项,但不知道如何将 excel 数据导入其中,我想任何其他好的 jquery 插件也可以提供帮助,只是研究时间很短

Please help!!!请帮忙!!!

jExcel can easily load data from csv file or json jExcel 可以轻松地从 csv 文件或 json 加载数据

if you spreadsheet is in csv format, it can be loaded into the jExcel like this:如果您的电子表格是 csv 格式,它可以像这样加载到 jExcel 中:

<div id='my-spreadsheet'></div>

<script>
jexcel(document.getElementById('my-spreadsheet'), {
    csv:'demo.csv',
    csvHeaders:true
});
</script>

the first line in your csv becomes the column header, and the data displayed in the grid. csv 中的第一行成为列标题,数据显示在网格中。

and when you save the changes, you can get the header and data by calling the two APIs:当您保存更改时,您可以通过调用两个 API 来获取标头和数据:

getHeaders()
getData()

and your REST API can handle the data whatever you want to do with it.并且您的 REST API 可以处理您想用它做什么的数据。

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

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