Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

html - How to create a download-link to an Excel file?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use simple html links:

link:

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

button:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...