Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is There A Way To Have An ASP Web Page With A Table Exported To Excel?

Posted on 2014-01-13
3
Medium Priority
?
301 Views
Last Modified: 2014-01-27
I have an ASP Web Page that displays a dynamic table with data. I am using Internet Explorer 11. If I right click and try "Export To Excel" I get an error.
"Unable to open http://.........asp. Cannot download the information.

Is there a way to get this to work?

I can right click and select and copy the table on the ASP web page and paste it into excel manually. I would prefer not to do this.

Thank you for any help.
Rick
0
Comment
Question by:ES-Components
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39777047
At the very top just below where you declare <%@LANGUAGE="VBSCRIPT"%> add

<%
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader "content-disposition", " filename=TheFileName.xls"
%>

Open in new window

0
 

Author Comment

by:ES-Components
ID: 39779136
This is the first few lines of code to this web page. You can see where I put your suggestion.
I get an HTTP500 error. The website can not display the page. Possible programming error.

Any ideas?

Thank you...
Rick


<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/CustomerHistory2.asp" -->
<!--#include file="Connections/OpenOrdersCustomer.asp" -->
<%
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader "content-disposition", " filename=TheFileName.xls"
%>
<%
Dim Recordset1__ShipTo
Recordset1__ShipTo = "1"
If (Request.Form("ShipTo")   <> "") Then
  Recordset1__ShipTo = Request.Form("ShipTo")  
End If
%>
<%
Dim Recordset1__varStartRange
Recordset1__varStartRange = "1/1/07"
If (Request.Form("Date1")   <> "") Then
  Recordset1__varStartRange = Request.Form("Date1")  
End If
%>
0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 39779182
The problem could be you have 2 include files first.  When the page loads, the include files are rendered as if the html/asp code was there.  So try

<%@LANGUAGE="VBSCRIPT"%>

<%
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader "content-disposition", " filename=TheFileName.xls"
%> 
<!--#include file="Connections/CustomerHistory2.asp" -->
<!--#include file="Connections/OpenOrdersCustomer.asp" -->

Open in new window


Also 500 errors are generic, you need to turn on your errors in iis or view the site on the server to see the exact error.  For now, try the suggestion above.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question