473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Render HTML doc as Excel

This is a simple report that is supposed to render as an Excel document, for
some reason it's not anymore, not sure why, I think it's related to
permissions, we recently added a domain user as the anonymous user for the
site, everyone has permissions to the virtual directory where the asp page is
executed.... Can someone give an idea as to why this is not working...?

Here's the error message I'm getting, from Excel:
Microsoft Excel cannot access the file 'http://BLAHBLAH.ASP?queryparams'
There are several possible reasons
* The file name or path does not exist
* The file you are trying to open is being used by another program.
Here's the ASP code...

<%@ LANGUAGE="VBSCRIPT"%>
<%
option explicit
Response.Expires = 0
Response.ContentType = "application/vnd.ms-excel"
%>

<!--#include virtual="/Include/odbvbs.asp"-->

<%
dim sSQL, anon, begdate, enddate, sortby, oRS

call ConnInit(cINTERNET)

anon = Request("ADDRESSED")
if anon = "Anonymous" then
anon = "true"
end if

begdate = Request("BEGINDATE")
enddate = Request("ENDDATE")
sortby = Request("SORTBY")

if sortby = "Date" then
sortby = "request_date"
end if

sSQL = "Select * "_
& "from requests (nolock) "_
& "where (request_date) >= '" +begdate+ "' AND (request_date) <= '"
+enddate+ "' "
if anon = "true" then
sSQL = sSQL + "AND (email) = 'blank' "
else
sSQL = sSQL + "AND (email) <> 'blank' "
end if

sSQL = sSQL + "ORDER BY " + sortby

'response.write(sSQL)
set oRS = obINTERNET.Execute(sSQL)

call QueueRS(oRS)

if not oRS.EOF then
%>

<html>
<table border=2>
<tr>
<td><b>Request Date</b></td>
<td><b>Email</b></td>
<td><b>Name</b></td>
<td><b>Product</b></td>
</tr>
<% Do While Not oRS.EOF %>
<tr>
<td><% = oRS("request_date")%></td>
<td><% = oRS("email")%></td>
<td><% = oRS("name")%></td>
<td><% = oRS("product")%></td>
</tr>

<%
oRS.MoveNext
Loop
%>
<%
end if
%>
<%
oRS.Close
obCC
%>
</html>
Jul 22 '05 #1
2 3013
I commented the ContentType declaration out and found it somebody removed the
database... The nerve of some people...;)

"Alien2_51" wrote:
This is a simple report that is supposed to render as an Excel document, for
some reason it's not anymore, not sure why, I think it's related to
permissions, we recently added a domain user as the anonymous user for the
site, everyone has permissions to the virtual directory where the asp page is
executed.... Can someone give an idea as to why this is not working...?

Here's the error message I'm getting, from Excel:
Microsoft Excel cannot access the file 'http://BLAHBLAH.ASP?queryparams'
There are several possible reasons
* The file name or path does not exist
* The file you are trying to open is being used by another program.
Here's the ASP code...

<%@ LANGUAGE="VBSCRIPT"%>
<%
option explicit
Response.Expires = 0
Response.ContentType = "application/vnd.ms-excel"
%>

<!--#include virtual="/Include/odbvbs.asp"-->

<%
dim sSQL, anon, begdate, enddate, sortby, oRS

call ConnInit(cINTERNET)

anon = Request("ADDRESSED")
if anon = "Anonymous" then
anon = "true"
end if

begdate = Request("BEGINDATE")
enddate = Request("ENDDATE")
sortby = Request("SORTBY")

if sortby = "Date" then
sortby = "request_date"
end if

sSQL = "Select * "_
& "from requests (nolock) "_
& "where (request_date) >= '" +begdate+ "' AND (request_date) <= '"
+enddate+ "' "
if anon = "true" then
sSQL = sSQL + "AND (email) = 'blank' "
else
sSQL = sSQL + "AND (email) <> 'blank' "
end if

sSQL = sSQL + "ORDER BY " + sortby

'response.write(sSQL)
set oRS = obINTERNET.Execute(sSQL)

call QueueRS(oRS)

if not oRS.EOF then
%>

<html>
<table border=2>
<tr>
<td><b>Request Date</b></td>
<td><b>Email</b></td>
<td><b>Name</b></td>
<td><b>Product</b></td>
</tr>
<% Do While Not oRS.EOF %>
<tr>
<td><% = oRS("request_date")%></td>
<td><% = oRS("email")%></td>
<td><% = oRS("name")%></td>
<td><% = oRS("product")%></td>
</tr>

<%
oRS.MoveNext
Loop
%>
<%
end if
%>
<%
oRS.Close
obCC
%>
</html>

Jul 22 '05 #2
<<
I commented the ContentType declaration out and found it somebody
removed the database... The nerve of some people...;)


Thanks for letting everyone know what the answer was! :)

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: George Ter-Saakov | last post by:
I am trying to wrap PlaceHolder so it will output prefix/suffix (like <div>, </div>) before render the actual control. So i created public class clsSection : PlaceHolder protected override...
1
by: Tomas | last post by:
Is there any sequence diagram on the web that clearly shows in which order all Page methods (load, render and so on) are being called compared to the order the page's contained control methods are...
6
by: vandalo | last post by:
Hi all I developed a service which can convert an office document (word, excel, powerpoint into HTML and save it on the file system To do this I use the "save as" functions of the office...
2
by: Sekhar | last post by:
I have a user control with a datagrid and few other information on title and summary. Will I be able to render this control on a Excel (Meaning Export to Excel) - just like the way we do for the...
2
by: Andrea Williams | last post by:
I have a form where the user chooses reporting options and when submit is clicked, I need to present them with dynamically created excel file. In Classic ASP I would just change the viewing...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
1
by: ad | last post by:
I use the codes below to render a Gridview to Excel. But it fail with RegisterForEventValidation can just be call in Render() But if myGrid is a DataGrid, it run well. How can I render a...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
2
by: Just Me | last post by:
Does anyone know if one can get to a representation of the rendered page ( after ) render. ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.