Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

creating excel sheet using coldfusion

New Here ,
Aug 06, 2009 Aug 06, 2009

hi,

i'm creating excel sheet from colfusion, and i want to include conditional formatting eg. if value>10 , bgcolor="red"

please let me know how can i do this?

thanks in advance.

1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 06, 2009 Aug 06, 2009

Hi

refer

http://www.bennadel.com/blog/435-Creating-And-Streaming-Simple-Microsoft-Excel-Files-With-ColdFusion.htm

OR

http://www.bennadel.com/blog/917-Creating-Excel-Files-With-ColdFusion-XML-And-POI.htm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 07, 2009 Aug 07, 2009

Turns out that if you output html tables and cells as an excel file, the cells automatically adjust into excel sheet.

The following sample should help you figure out.

<cfheader name="CONTENT-DISPOSITION" value="attachment; filename=nameoffile.xls">
<cfcontent type="application/vnd.ms-excel" reset="yes">

<cfset getfields = 'CompanyName,BusinessAddress,BusinessPhone'>

<cfquery name="getquery" datasource="#yourdsn#" dbtype="ODBC">

select #getfields# from table

</cfquery>

<table>
<tr>
<cfloop index="getitem" list="#getfields#">
<td><cfoutput>#getitem#</cfoutput></td>
</cfloop>
</tr>
<cfloop query="getquery">
<tr>
<cfloop index="getitem" list="#getfields#">
<td><cfoutput>#evaluate(getitem)#</cfoutput></td>
</cfloop>
</tr>
</cfloop>
</table>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 11, 2009 Aug 11, 2009
LATEST

Depending on what your development schedule is like, it may be worth holding off until CF9 comes (fall, I think?) - the <cfspreadsheet> tag looks like its exactly what you need.  Barring that, I think the already suggested solutions should work for you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources