Current location: Hot Scripts Forums » Programming Languages » ASP » click in image then export to excel


click in image then export to excel

Reply
  #1 (permalink)  
Old 03-19-04, 11:08 PM
angela angela is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
click in image then export to excel

Hello

How do i export the table to the excel spreadsheet? i need to export the table below to the excel spreadsheet... i need to click on an image that can link to show the table on the spreadsheet...but how do i do that?

or do i need to do it in another asp page..


IF CustQuery.EOF Then
%>

<tr bgcolor="#FFFFFF" height="5">
<td><font face="Arial" size="2">No records for this Month</font></td>
</tr>
<%
Else
'Tells the browser to open excel
If(rowCount MOD 2 = 0) Then
%>

<tr bgcolor="#FFFFFF" height="5">
<td><font face="Arial" size="2"><%=CustQuery("Given_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Family_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Company_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("BusinessPhone")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Email")%></font></td>
</tr>
<%
Else
%>
<tr bgcolor="#EFEFEF" height="5">
<td><font face="Arial" size="2"><%=CustQuery("Given_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Family_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Company_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("BusinessPhone")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Email")%></font></td>
</tr>

<%
'CustQuery.MoveNext()
'Loop

End If ' end for rowcount
rowCount = rowCount + 1

End If
Next

CustQuery.Close
Set CustQuery = Nothing

<a href="<%Response.ContentType = "application/vnd.ms-excel"%>" onmouseout="return window.status=''" target="_blank">
<img border="0" src="images/xl.gif"></a><font face="Arial" size="2"><b>Export list to Excel</font></b></tr>

i am refering to the code below...but still don't get it....
http://www.codeave.com/asp/code.asp?u_log=40

Last edited by angela; 03-19-04 at 11:24 PM.
Reply With Quote
  #2 (permalink)  
Old 03-23-04, 06:55 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by angela
Hello

How do i export the table to the excel spreadsheet? i need to export the table below to the excel spreadsheet... i need to click on an image that can link to show the table on the spreadsheet...but how do i do that?

or do i need to do it in another asp page..


IF CustQuery.EOF Then
%>

<tr bgcolor="#FFFFFF" height="5">
<td><font face="Arial" size="2">No records for this Month</font></td>
</tr>
<%
Else
'Tells the browser to open excel
If(rowCount MOD 2 = 0) Then
%>

<tr bgcolor="#FFFFFF" height="5">
<td><font face="Arial" size="2"><%=CustQuery("Given_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Family_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Company_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("BusinessPhone")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Email")%></font></td>
</tr>
<%
Else
%>
<tr bgcolor="#EFEFEF" height="5">
<td><font face="Arial" size="2"><%=CustQuery("Given_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Family_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Company_Name")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("BusinessPhone")%></font></td>
<td><font face="Arial" size="2"><%=CustQuery("Email")%></font></td>
</tr>

<%
'CustQuery.MoveNext()
'Loop

End If ' end for rowcount
rowCount = rowCount + 1

End If
Next

CustQuery.Close
Set CustQuery = Nothing

<a href="<%Response.ContentType = "application/vnd.ms-excel"%>" onmouseout="return window.status=''" target="_blank">
<img border="0" src="images/xl.gif"></a><font face="Arial" size="2"><b>Export list to Excel</font></b></tr>

i am refering to the code below...but still don't get it....
http://www.codeave.com/asp/code.asp?u_log=40
Just do it in a separate asp page. Use your existing ASP page (ie. copy it and rename it) , but put the Response.ContentType="application/vnd.ms-excel" call at the very top of the page before any html has been sent back.
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
  #3 (permalink)  
Old 06-10-04, 10:29 AM
cgm cgm is offline
New Member
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hi. That way works perfect.
But if I want to click in image then export to excel directly, like I do right click then select "Export To Microsoft Excel". How do I do.

someone has idea? Thanks
Reply With Quote
  #4 (permalink)  
Old 09-02-05, 06:53 PM
dypsoprogram dypsoprogram is offline
Newbie Coder
 
Join Date: May 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Hi, let have a look here : http://dypso.free.fr/tech
Reply With Quote
  #5 (permalink)  
Old 09-02-10, 05:55 AM
maryjok3698 maryjok3698 is offline
New Member
 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,
Here is c# excel/vb.net excel /asp.net excel component can do this easy, it's named Spire.XLS. I use it from last year.

Hope help to you.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with viewing uploaded image on webpage? mikewooten PHP 0 03-16-04 07:39 PM
Loading an image into database with customerID pecobrown PHP 2 02-27-04 01:11 PM
how to change text dynamically with image? rabbit51 JavaScript 1 02-23-04 08:35 AM
image load glitch bentley JavaScript 1 02-16-04 09:44 AM
How to change text dynamically with image? rabbit51 Script Requests 0 02-07-04 12:14 PM


All times are GMT -5. The time now is 04:16 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.