Clarification on what can be exported to excel on ipad

懵懂的女人 提交于 2019-12-13 04:45:45

问题


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


回答1:


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:\name_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



来源:https://stackoverflow.com/questions/10692484/clarification-on-what-can-be-exported-to-excel-on-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!