在 Grails 中使用导出功能时将生成的文件保存到本地磁盘

发布于 2024-10-08 01:54:22 字数 522 浏览 0 评论 0原文

要求: 我有一个显示表格数据的页面。单击按钮后,该数据应导出到 Excel,附加到邮件中并发送。

到目前为止我所做的: 我已经使用导出插件在 Grails 中实现了导出到 Excel 的功能。

在 javascript 中使用 Outlook 对象的邮件功能如下所示。 发送邮件之前弹出的 Outlook 消息grails

但是,当我使用 OutlookObject 时,我提到了附件,如下所示。

var attach1 = "c:\\temps\\test.txt"

在这种情况下,附件是从本地驱动器获取的。

问题: 当我将表格数据导出到 Excel 时,有没有办法将文件保存到本地驱动器,以便可以从同一位置读取附件并作为附件在邮件中发送。

提前致谢!

Requirement:
I have a page wherein tabular data is displayed. On click of a button, this data should be exported to an excel, attached to a mail and sent.

What I have done till now:
I have achieved export to excel functionality in Grails using the export plugin.

And Mail Functionality using outlook Object in javascript as in below post.
Outlook message to pop up before mail is sent in grails

However when I use OutlookObject I mention the attachment as below.

var attach1 = "c:\\temps\\test.txt"

In this case the attachment is taken from the local drive.

Question:
While I export my tabular data to an excel, Is there a way to save the file to the local drive so that the attachment can be read from the same location and sent in the mail as an attachment.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

茶底世界 2024-10-15 01:54:22

不幸的是,您无法告诉浏览器在哪里保存某些内容或询问它最近保存的文件的位置,所以不是真的。您可以做的是将文件导出并保存到用户的硬盘驱动器和在线某个地方,并在发送电子邮件时使用在线版本。

Unfortunately you can't tell a browser where to save something or ask it for the location of a recently saved file so not really. What you could do is have the file exported and saved both to the users hard drive and somewhere online and use the online version when sending the email.

多情癖 2024-10-15 01:54:22

不确定它是否有帮助,但通常无法在 JavaScript 中访问本地文件系统。

Not sure if it helps here but generally there is no way to access the local file system in JavaScript.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文