Sure - I only have code right here that uses the jexcelapi one (the
POI is at home, but they basically work the same)
You add the jar to your cfmx classpath (google if you dont know) then
you do have access to the java libraries. For example to read an excel
file:
<!--- 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("Sheet1");
</cfscript>
<cfcatch type="any">
<cfoutput>
<br>
<div class="error">
#cfcatch.message#<br>
</div>
</cfoutput>
</cfcatch>
</cftry>
Then later to get the values out
<cfset serialnum = sheet.getCell(0,javacast('int',r)).getContents()>
<cfset return1 = sheet.getCell(1,javacast('int',r)).getContents()>
To write the sheets you do the opposite - adding styles to cells if needed.
Both products have APIs that you'll have to dig through to do what you
want, but that's the basics.
On Apr 12, 2005 12:00 PM, Neelima Kaja
<[EMAIL PROTECTED]> wrote:
> Hi,
> Could you explain a little more on how u used these?
>
> Thanks
>
> >I have used POI with great success - http://jakarta.apache.org/poi/ -
> >to read and write excel files. I've also used
> >http://jexcelapi.sourceforge.net/ on a couple of cf projects and it
> >worked well too. Both are pure java and allow you to create binary
> >versions xls files
> >
> >Cheers
> >
> >On Apr 4, 2005 7:57 PM, Nathan Drury <[EMAIL PROTECTED]> wrote:
> >--
> >~Blog~
> >http://www.robrohan.com
> >~The cfml plug-in for eclipse~
> >http://cfeclipse.tigris.org
> >~open source xslt IDE~
> >http://treebeard.sourceforge.net
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202485
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54