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

查看:70
本文介绍了如何创建指向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天全站免登陆