在ExtGWT中上传并读取excel文件
我正在使用 ExtGWT。在我的应用程序中,我应该通过浏览按钮接受excel文件,并且应该读取excel文件的内容并显示在网格中。请建议我如何实现这一目标。
谢谢!
I am using ExtGWT. in my application i should accept excel file through browse button and should read the content of excel file and display in a grid. please suggest me how to achieve this.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须通过
FileUploadField
上传 Excel 文档 - 请参阅:API 和 示例在您的服务器上,您必须读取该文件并通过外部 Excel API 解析它,例如
然后你将结果传递给你的客户端
列出
并将其显示在编辑器网格上。请小心文件上传,因为文件上传方式与常规 GXT 表单不同。
正如您在示例中看到的,您需要为表单指定一个
URL
最简单的方法是为此操作编写一个 servlet 并像 commons-fileupload
遗憾的是,某些浏览器不支持通过
XMLHttpRequest
上传文件。You will have to upload the excel document via a
FileUploadField
- See: API and ExampleOn your server you will have to read the file and parse it via an external Excel API like one of those
Then you pass the result to your client as
List<ModelData>
and display it on your editor grid.Be careful about the fileupload because the file is not uploaded in the same way like your regular GXT forms.
As you can see in the example you need to specify an
URL
for your formThe easiest way, would be to write a servlet for this action and process the file there like that with commons-fileupload
Uploading files via
XMLHttpRequest
is unfortunately not supported by some browsers.