If you are not afraid of java,

http://jexcelapi.sourceforge.net/

Works great - slap it in your servers class path then you can read and
write excel files, add formulas, change cell colors, and even add
pictures. I have used it on a couple projects, and it works well.

Its free and open source of course :)

here is an example of a read

<!--- create the excel java reader --->
<cftry>
<cfscript>
//get a handle to the workbook file
wfile = createObject("java","java.io.File").init(xlfile);

//create the workbook and load the file
workbook = createObject("java","jxl.Workbook");

//get a writeable workbook
wworkbook = createObject("java","jxl.write.WritableWorkbook");
wworkbook = workbook.getWorkbook(wfile);

//get the first sheet
sheet = createObject("java","jxl.write.WritableSheet");
sheet = wworkbook.getSheet("test");
</cfscript>

<cfcatch type="any">
<cfoutput>
<br />
<div class="error">
#cfcatch.message#<br />
</div>
</cfoutput>
</cfcatch>
</cftry>

and reading a cell

<cfset r=1>
<cfset return1   = sheet.getCell(1,javacast('int',r)).getContents()>

It has quite a bit of documentation, and examples as well.

On Fri, 20 Aug 2004 12:32:19 -0400, cf coder
<[EMAIL PROTECTED]> wrote:
> Hello everybody,
>
> I've written this code that exports the search results to a csv file. Here is the code:
>
> <CFFILE ACTION=""> >    FILE="searchResults.csv"
>     ADDNEWLINE="Yes"
>     OUTPUT="Date, Ref, Name #Chr(10)##Chr(10)#">
>
> <CFSET QUOTE = Chr(127)>
> <cfoutput query="qSearch">
>         <CFSET log_string = QUOTE & LogTime & QUOTE & ","
>                 & QUOTE & Reference & QUOTE & ","
>                 & QUOTE & FirstName & QUOTE>
>
>         <CFFILE ACTION=""> >         FILE="searchResults.csv"
>         ADDNEWLINE="Yes"
>         OUTPUT="#log_string#">
> </cfoutput>
>
> <CFHEADER NAME="Content-Type" VALUE="application/unknown">
> <CFHEADER NAME="Content-Disposition" VALUE="inline; filename=searchResults.csv">
> <CFCONTENT TYPE="application/msexcel" FILE="searchResults.csv" deletefile="Yes">
>
> I was wondering if its possible that when the display the header information (Date, Ref, Name)
> with some background colour formatting to the text.
>
> So for example when the above code is executed, the .csv file opens up with 3 columns:
>
> Date        Ref                 Name
> 20/08/2004  T123345             Joe Bloggs
>
> Can I specify something in the code to for example make the header text colour to blue. If yes,
> can someone please show me the code or give me some tips.
>
> Best regards
> cfcoder
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to