Home > InfoTech > CF7 – Creare un file excel

CF7 – Creare un file excel

September 16th, 2005 Lascia un commento Vai ai commenti

Posto questa interessante pagina di macromedia che spiega come generare un file excel partendo da una visualizzazione html di una query.

CFM 2 EXCEL

Per completezza riporto anche il codice:


<cfsetting enablecfoutputonly="Yes">
<!— Get employee info. —>
<cfquery name="GetEmps" datasource="cfdocexamples">
SELECT * FROM Employee
</cfquery>
<!— Set content type. —>
<cfcontent type="application/msexcel">
<!— Suggest default name for XLS file. —>
<!— "Content-Disposition" in cfheader also ensures
relatively correct Internet Explorer behavior. —>
<cfheader name="Content-Disposition" value="filename=Employees.xls">
<!— Format data using cfoutput and a table.
Excel converts the table to a spreadsheet.
The cfoutput tags around the table tags force output of the HTML when
using cfsetting enablecfoutputonly="Yes" —>
<cfoutput>
<table cols="4">
<cfloop query="GetEmps">
<tr>
<td>#Emp_ID#</td>
<td>#FirstName#</td>
<td>#LastName#</td>
</tr>
</cfloop>
</table>
</cfoutput>
 

 

Approfondimenti online

La tecnologia informatica ha fatto passi da gigante. In modo particolare Google, che con il suo analizzatore di testo, è in grado di proporre collegamenti contestuali a quanto hai appena letto. Questi i link pubblicitari proposti da Adsense.

Categorie: InfoTech Tag: ,

Additional comments powered by BackType