Link to home
Start Free TrialLog in
Avatar of pr_r
pr_r

asked on

asp excel download

hi all
i have to create an excel file and force download that page. i have used the
fiollowing code
<% Response.Buffer=true
Response.ContentType = "application/vnd.ms-excel"
 Response.AddHeader "Content-Disposition", _
      "attachment; filename=MRExcelreport.xls"
      Response.Flush()%> and it works fine
but i have a css in that asp file
     <link rel="stylesheet" href="../int1.css">
when i click on the button excel from another file which links to the above coded file.and it shows a dialog asking me whether to save or open when i save it is telling CSS is missing
how can i resolve this?
Avatar of hongjun
hongjun
Flag of Singapore image

Does the download works if you remove the <link...>?

hongjun
Avatar of pr_r
pr_r

ASKER

it is working
bu t telling that c://......./int1.css file is missing
Avatar of pr_r

ASKER

it is working
bu t telling that c://......./int1.css file is missing
Can you post all your code? Is your int1.css really exist and is in 1 level higher ../?

hongjun
Avatar of pr_r

ASKER

if i take out response.content type and all it s displaying perfectly.
Can you post all your code?
Avatar of pr_r

ASKER

it contains some 2000 lines. it is very difficult
let me try cut it and paste. i will do it tomorrow
Avatar of pr_r

ASKER

    when i save excel i saving..
when i double click excel message shown is like this.
I want the same html format in excel also
c:\winnt\profiles\pr\int1.css missing
Please do not paste the 2000 lines. Perhaps other experts will be able to help you.

hongjun
Avatar of pr_r

ASKER

i want to cancel this question how will i do this
Post a zero point question to Community Support Topic Area and post to request to delete https://www.experts-exchange.com/questions/20434660/asp-excel-download.html and a EE moderator will do the deletion for you.

hongjun
What I figure out of your problem is that you are getting a file(Excel) downlaoded which in turn has a dependency on CSS. The CSS has to be downladed first and the path link for CSS in the Excel needs to be correct.
Avatar of Mark Franz
Using this; Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", _
     "attachment; filename=MRExcelreport.xls"
does not require a .css page.  Basically all you are calling is a script to open a dounload file dialog box, there are no style properties available in the dialog box.
Avatar of pr_r

ASKER

let me explain
i have apage mrexcelreport.asp

in that i have given the code.
<% Response.Buffer=true
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", _
     "attachment; filename=MRExcelreport.xls"
     Response.Flush()%>
and rest all the asp coded which needs to be exported....
and in that inside the body tag there is
 <link rel="stylesheet" href="../int1.css">


and when i run this page a dialog box opens asking save or open. when isave it is savcing fine in destop. when i doubleclicked on the saved xsl file it is telling c:=winnt\profiles\pr\int1.css is missing
Why are you exporting asp code when all you need to export is a .xls file?  

Post the whole page code.
A request has been made to delete this question; if there are no objections within 72 hours, the request will be granted.

EXPERTS: Please leave your comments regarding this issue here.

Netminder
EE Admin
No problem
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial