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
527 views
in Technique[技术] by (71.8m points)

asp classic - Clarification on what can be exported to excel on ipad

Trying to fix an old .asp site to work on an ipad. One of the features is the users ability to download their search results into an excel worksheet. The code uses:

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=results.xls" 
Response.CharSet = "iso-8859-1"

When viewing the site on the ipad, when the link is click for the page with the code above it does nothing, just spins. Is it the fact that I am trying to export the data as excel, I have read in some posts how it is the encoding! Should I convert the code to export the results page as a csv file and then allow the user to open it in anything they want/have available? What's the best way to do it to hit the most devices...

Thanks

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

In the past i'd a same scenario so what i did:

FILE: DOWNLOAD.ASP

<%  
' get the file to download
myFile = request.querystring("File")
myFullPath = "c:
ame_folder" & myFile ' example of full path and filename

' set headers
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=" & myFile

' send the file using the stream as

Set adoStream = CreateObject("ADODB.Stream") 
adoStream.Open() 
adoStream.Type = 1 
adoStream.LoadFromFile(myFullPath) 
Response.BinaryWrite adoStream.Read() 
adoStream.Close 
Set adoStream = Nothing
%>

FILE: HTML

<a href="DOWNLOAD.ASP?File=result.xls">Download Excel file</a>

This example is full working with Ipad using the native browser Safari. The file Result.xls is downloaded and loaded in the Viewer whitout the capability to be edit.

My iPad users use the App QuickOffice to let the file be saved in a virtual folder, rename the file, delete, ... but they cant edit the file, that App is just for manage the files and isnt required for download the file.

If your user need also edit the XLS file on the iPad i suggest to use (for example) the Google App Document, it let the user to edit and manage the file directly in the browser.

Hope it help


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

...