当从我的网页下载电子表格 (.xls) 时,如何在 MS Excel 07 电子表格中显示计数器(即下载次数)?
我知道在网页上显示计数器很容易,但我需要实现相同的功能,即每次有人从我的网页下载 Excel 2007 电子表格时,我都需要将数据写入到 Excel 2007 电子表格中的单元格中。 更准确地说,当用户将 excel 文件下载到硬盘并打开它时,我希望电子表格在一个单元格中显示 .xls 文件的下载次数(当然还包括包含以下内容的其他单元格):数据)。
我只需要弄清楚如何以编程方式与 Excel 07 工作表进行通信。
I know it is easy to display a counter on a webpage but I need to implement the same, ie, I need to write data to a cell in the Excel 2007 spreadsheet every time a person downloads it from my webpage.
To be more precise, when the user downloads the excel file to his hard drive and when it is opened, I want the spreadsheet to display the number of times the .xls file has been downloaded, in a cell (ofcourse along with other cells containing data).
I just need to figure out how do i programmmatically communicate with Excel 07 sheet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这听起来像是徒劳的做法,因为一旦下一个人下载该文件,该数字就会过时。 这是你真正想做的吗?
如果是,则很可能使用一些服务器端脚本。 PHP、Perl 和其他语言都有可用于以编程方式编辑 Excel 文件的库。 选择您最舒服的一个,然后从那里开始。
编辑:
我认为,既然您同时控制 Excel 文件和网站,最好的方法就是向网站添加一个计数器,并通过 Web 查询在 Excel 文件中引用它。 如果您不熟悉 Web 查询,它们是 Excel 中的一个工具,可让您从 Web 导入表,每次加载文件时(或者即使用户点击刷新),这些表都会刷新。 以下是有关Web 查询工具的详细信息。
让我知道这个解决方案是否适合您。
编辑2:
这是一个链接到更多-最新教程。
That sounds like an exercise in futility since the number will be out of date as soon as the next person downloads the file. Is this what you really want to do?
If yes, it's very possible using some server-side scripts. PHP, Perl and other languages all have libraries that can be used to edit Excel files programmatically. Pick the one you are most comfortable with and go from there.
EDIT:
I think the best way to go since you control both the Excel file and the website is to add a counter to the website, and reference it in your Excel file via web queries. If you're not familiar with web queries, they are a tool in excel that let you import tables from the web that will be refreshed everytime the file loads (or even if a user hits refresh). Here's more information about the Web Query Tool.
Let me know if this solution works for you.
EDIT2:
Here's a link to a more up-to-date tutorial.