|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
export excel
hai..i got problem here..i got error cannot open file when i want to export query to excel...here is my code..
below is the link to another action page... <Cfoutput><a href="excel.cfm" target ="_blank">Export To Excel</a></cfoutput> below is the action page (excel.cfm)... <cfheader value="attachment; filename=excel.xls" name="Content-disposition"> <cfcontent type="application/vnd.ms-excel"> <cfif varLogin EQ 'All'> <CFQUERY NAME="qSearch" DATASOURCE="#REQUEST.DSN#" > SELECT EDMS_LOGINHISTORY.*, EDMS_USER.USER_LOGIN, EDMS_USER.USER_NAME FROM EDMS_LOGINHISTORY, EDMS_USER </cfquery> <CFOUTPUT query="qSearch" StartRow="#StartRow#" MAXROWS="#MaxRows#"> <TR bgcolor="white"> <TD align="center"><font size="1">#CurrentRow#</FONT></TD> <TD align="left"><font size="1">#USER_LOGIN#</FONT></TD> <TD align="left"><font size="1">#USER_Name#</font></td> <TD align="left"><font size="1">#Dateformat(TIMELOGIN, 'DD-Mmm-yyyy')# #Timeformat(TIMELOGIN, 'HH:MM:TT')#</FONT></TD> <TD align="left"><font size="1"><cfif TIMELOGOUT NEQ "">#Dateformat(TIMELOGOUT, 'DD-Mmm-yyyy')# #Timeformat(TIMELOGOUT, 'HH:MM:TT')#</cfif></FONT></TD> </TR> </CFOUTPUT> what is wrong with this code???can somebody help me?? |
|
#2
|
|||
|
|||
|
Your cfcontent and cfheader tags look right, thats usually the key. Other than that, drop those tags and make absolutely sure the page renders a nice clean html table, then put the tags back in place, and hopefully it will work. I see that you have an unclosed <cfif varLogin EQ 'All'> , and you have omitted the opening and closing <TABLE> tags (you will need these). I dont think you absolutely need open/close HTML, HEAD, and BODY tags, but I use them also. The version of Excel you are running may also make a difference. Im running Excel 2002 on Win2k.
|
|
#3
|
|||
|
|||
|
i know where is the problem now...it is in my query..i have to query data from two different table..so it won;t work..but i have to query different data from this two table to export in excel ...
this is my query .. <CFQUERY NAME="qSearch" DATASOURCE="#REQUEST.DSN#" > SELECT EDMS_LOGINHISTORY.*, EDMS_USER.USER_LOGIN, EDMS_USER.USER_NAME FROM EDMS_LOGINHISTORY, EDMS_USER </cfquery> so how can i fix it ?i try many ways but it won't work....i have twi table which are EDMS_LOGINHISTORY and EDMS_USER....if i try query from one table, there is no problem..but if i query frorm two table it wont work...help me please... |
|
#4
|
|||
|
|||
|
I'm assuming that you need to read up on SQL. Specifically the option of joining two tables together.
http://www.w3schools.com/sql/sql_join.asp
__________________
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > export excel |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|