These days in the classic, 5D met a lot of people in the question, how to use CF to generate Excel files, last night wrote a model program put up for everyone's reference.
I suggest that you understand first, the procedure itself is not complicated, if you do not understand the question again, it is best not to look at the question ...
OK, I'll use my CCF forum database to do experiments, to open Excel files online and generate Excel files online. The contents of the file is the name and number of all the CCF forum. I did it by the way. The code was changed in one place. Let's take a closer look.
Open Office files online must have Office installed on your system. Remember this, or you will be prompted to download.
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<cfquery name= "viewlist" datasource= "#request. dsn#" >
Select Boardid,boardname from board
ORDER BY Boardid
</cfquery>
<title>ccforum Column List </title>
<body>
<center><table border= "1" align= "Center" >
<TR><TD align= "center" ><b> number </b></td><td align= "center" ><b> name </b ></td></tr>
<cfoutput query= "Viewlist" >
<TR><TD align= "center" > #boardID #</td><td align= "left" > #boardname #</td></tr>
</cfoutput>
</table>
<p>
<center>
<a href= "web.cfm" target= "_blank" > Open with Excel on Web </a><br><br>
<a href= "doc.cfm" target= "_blank" > Open with Word on web </a><br><br>
<a href= "file.cfm" target= "_blank" > Generate Excel files and download </a><br><br><br>
CopyRight (C) Wait hunanet.com
</center>
</body>
<!-----This file is a code that is used to open online as an Excel file---->
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<cfsetting enablecfoutputonly= "Yes" >
<cfquery name= "Getboard" datasource= "#request. dsn#" >
Select Boardid,boardname from board
ORDER BY Boardid
</cfquery>
<!--------Add a Build Word demo .... Note that only one place has been changed.--------->
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<cfsetting enablecfoutputonly= "Yes" >
<cfquery name= "Getboard" datasource= "#request. dsn#" >
Select Boardid,boardname from board
ORDER BY Boardid
</cfquery>
<!---We are concerned, we are going to do an important part---->
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<cfsetting enablecfoutputonly= "Yes" ><!--remove whitespace and improve performance-->
Notably, I kept the dynamically generated XLS file in a folder called file. You must first create a file folder when you run this code .... Otherwise there will be an error.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.