如何创建 Excel 文件的下载链接? [英] How to create a download-link to an Excel file?

查看:44
本文介绍了如何创建 Excel 文件的下载链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Excel 电子表格 (.xls),我希望用户能够从我的网页下载它.也许页面上有一个下载"按钮,当用户点击它时,文件就会被下载.

I have an Excel Spreadsheet (.xls) which i want the users to be able to download it from my webpage. Maybe a 'download' button on the page and when users click on it, the file will be downloaded.

我可以知道如何做到这一点吗?代码片段和参考将不胜感激.

May i know how can this be done? Code snippets and references will be appreciated.

推荐答案

您可以使用简单的 html 链接:

You can use simple html links:

链接:

<a href='/path/to/excel/file.xls' target="_blank">Download</a>

按钮:

<form>
<input type="button" value="Download" onClick="window.location.href='/path/to/excel/file.xls'">
</form>

这篇关于如何创建 Excel 文件的下载链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆