ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2004, 01:28 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,190 Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 27471 Folding Title: Starter FolderFolding Points: 27471 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 11 h 27 m 49 sec
Reputation Power: 755
Blank Excel report

I am creating some reports that i want to have opened in Excel. I have put all data for the report in a table and have tried using cfcontent to have excel open the report. however, whenever excel opens it, it is always blank. if i display the report in goold ole HTML, i see that data just fine. Anybody got any ideas?

Reply With Quote
  #2  
Old October 19th, 2004, 01:53 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,651 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 21 m 47 sec
Reputation Power: 53
Post the code please.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old October 19th, 2004, 02:12 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,190 Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 27471 Folding Title: Starter FolderFolding Points: 27471 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 11 h 27 m 49 sec
Reputation Power: 755
<CFCONTENT TYPE="application/vnd.ms-excel">
<cfif #form.selectMetric# eq 2>
<cfquery name="Metric2" datasource="#variables.datasource#">
SQL HERE
</cfquery>
<table border="1">
<tr><td><h2>Average number of redeliveries for the same Test Defect per project/release</h2></td></tr>
<cfoutput query="Metric2">
<tr>
<td>Release:</td><td>#form.ReleaseList#</td><td>Percent:</td><td>#decimalformat(metric2.count)#%</td>
</tr>
</cfoutput>
</table>
</cfif>

Reply With Quote
  #4  
Old October 19th, 2004, 02:29 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,651 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 21 m 47 sec
Reputation Power: 53
I'm doing it like this and it works fine:

<cfheader name="Content-disposition" value="inline; filename=exceldata.xls">
<cfcontent type="application/msexcel" reset="No">
...html table for excel to render...

Reply With Quote
  #5  
Old October 21st, 2004, 12:29 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,190 Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 27471 Folding Title: Starter FolderFolding Points: 27471 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 11 h 27 m 49 sec
Reputation Power: 755
Well i found it seems to be something with my desktop (if i try using a different computer it comes up just fine).

Reply With Quote
  #6  
Old November 5th, 2004, 11:02 AM
jperez jperez is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 5 jperez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 42 sec
Reputation Power: 0
Quote:
Originally Posted by Ebot
Well i found it seems to be something with my desktop (if i try using a different computer it comes up just fine).


I am having the same problem, some users are getting blank screen and others are not. Does anyone know why this would happen? Is it a browser or browser setting issue?

John

Reply With Quote
  #7  
Old November 5th, 2004, 11:25 AM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,190 Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 27471 Folding Title: Starter FolderFolding Points: 27471 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 11 h 27 m 49 sec
Reputation Power: 755
Well i have been wrestling with the problem and it seems to be something with Microsoft Office. I have tried the code on a couple of machines, and the ones with 97 work fine, while any with 2002 will just show a blank document.

Reply With Quote
  #8  
Old November 5th, 2004, 01:29 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,190 Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 27471 Folding Title: Starter FolderFolding Points: 27471 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 11 h 27 m 49 sec
Reputation Power: 755
Ok, i found the problem. Here is what you need to do, for you cfcontent and whatnot, use the following:

<cfsetting enablecfoutputonly="Yes">
<cfcontent type="application/msexcel">
<cfheader name="Content-disposition" value="filename=Metrics.xls">

Now here is the fun bit, you need to have all of your table, tr, td, etc tags enclosed in a cfoutput tag. don't know why it has the problem, but it at least solves the problem while looking for a cleaner solution.

Reply With Quote
  #9  
Old November 22nd, 2004, 11:42 AM
marzipan14 marzipan14 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 marzipan14 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Download to Excel as a "click here" link

I'm trying to download to excel as an option after the cfquery results are displayed in a browser. The results I get is also a blank excel report. I've tried to add the options you suggested "cfsetting enable output"...."cfheader..." but these tags return results automatically in excel which I don't want. Please review this code and offer any suggestions. Thanks!
<cfquery name="getName" datasource="xxxx" >
SELECT *
FROM tblEmployees
</cfquery>
<cffile action="write" file="Employee.xls" output="
<cfcontent type='application/vnd.ms-excel' >
<table border='1'>
<tr>
<td>Last Name</td>
<td>First Name</td>
<td>Phone Number</td>
</tr> " addnewline="Yes">

<cfoutput>
<cfloop query="getName">
<cffile action="append" file="c:\TEMP\Employee.xls" output="
<tr>
<td># Last_Name #</td>
<td># First_Name #</td>
<td># Phone_Number #</td>
</tr>" addnewline="Yes">
</cfloop>
</cfoutput>
<cffile action="append" file="c:\TEMP\Employee.xls" output="</table> " addnewline="Yes">
<div align="center">
<a href="Employee.xls" onClick="getName">View Report in Excel</a>
</div>

Reply With Quote
  #10  
Old November 22nd, 2004, 12:51 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,651 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 21 m 47 sec
Reputation Power: 53
If you want to link directly to the .xls file then there's nothing else you can do except instruct the user to associate .xls files with Excel so that their browser knows not to display it but to open it with Excel. To the browser all it sees is HTML tags so that's what it outputs. Without adding in <cfheader> and <cfcontent> (which would prevent you from linking directly to the .xls file) there's no other way to tell the browser you really want to open it in Excel.

Reply With Quote
  #11  
Old November 23rd, 2004, 09:20 AM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,190 Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)Ebot User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 27471 Folding Title: Starter FolderFolding Points: 27471 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 11 h 27 m 49 sec
Reputation Power: 755
well, after your query has run, display it in HTML with an option to save to Excel (which would resumbit the query). then place in some if then logic to turn on the cfheader information needed to display in excel.

Reply With Quote
  #12  
Old February 2nd, 2005, 01:24 AM
SathishS SathishS is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 SathishS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 24 sec
Reputation Power: 0
Blank Excel Report

Quote:
Originally Posted by kiteless
I'm doing it like this and it works fine:

<cfheader name="Content-disposition" value="inline; filename=exceldata.xls">
<cfcontent type="application/msexcel" reset="No">
...html table for excel to render...


I used the same method and i got it correct.But the problem is the grids in the excel worksheet is not visible.Do anybody knows how to do it.. The worksheet grid shud be displayed for my Clients application. Please help me out in this regard

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Blank Excel report


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump