Basic formulas with the query2xls component
I've added some formula handling to the query2xls component.
Basically, you create an empty query column, and then pass in a formula
for evaluation along with that empty column name.
Something like this:
<cfset queries = structNew() />
<cfset formulas = structNew() />
<cfset queries[1]["sheet1qry"] = data />
<cfset formulas[1]["formulas"] = formula />
<cfset daXls = query2xls.queriesToXLS(queries,formulas) />
<cfset cvalue = 'attachment;' />
<cfset cvalue = cvalue & "filename=test.xls" />
<cfheader name="Content-Disposition" value="#cvalue#" />
<cfcontent type="application/msexcel" variable="#daXls#" reset="true" />
<cfabort />
Where data is a query, and formula is a string like this: formulacolumn = SUM(discount + amount)
formulacolumn being an empty query field, and discount and amount being numeric query columns.
http://coldshen.com/cfjexcel
Source is here:
http://cfjexcel.googlecode.com
Zip of the source:
http://code.google.com/p

There are no comments for this entry.
[Add Comment] [Subscribe to Comments]