ColdFusion Component Wrapper For POI To Read And Write Excel Files

<!---
	Create an array to define the sheets that we
	want to pass in. We are going to use the queries that
	we read in previously.
--->
<cfset arrSheets = ArrayNew( 1 ) />
 
<!---
	Set up a sheet for the Breakfast meal. We can get a default
	structure from the POI utility (as below) or we could just
	create our own struct of the same type (but this is a nice
	short hand and easy to debug).
--->
<cfset arrSheets[ 1 ] = objPOIUtility.GetNewSheetStruct() />
<cfset arrSheets[ 1 ].Query = objSheet[ 1 ].Query />
<cfset arrSheets[ 1 ].SheetName = "NEW Breakfast" />
<cfset arrSheets[ 1 ].ColumnList = "column1,column2,column3" />
<cfset arrSheets[ 1 ].ColumnNames = "Food,Quantity,Tastiness" />
 
<!--- Set up a sheet for the Lunch meal. --->
<cfset arrSheets[ 2 ] = objPOIUtility.GetNewSheetStruct() />
<cfset arrSheets[ 2 ].Query = objSheet[ 2 ].Query />
<cfset arrSheets[ 2 ].SheetName = "NEW Lunch" />
<cfset arrSheets[ 2 ].ColumnList = "column1,column2,column3" />
<cfset arrSheets[ 2 ].ColumnNames = "Food,Quantity,Tastiness" />
 
<!--- Set up a sheet for the Dinner meal. --->
<cfset arrSheets[ 3 ] = objPOIUtility.GetNewSheetStruct() />
<cfset arrSheets[ 3 ].Query = objSheet[ 3 ].Query />
<cfset arrSheets[ 3 ].SheetName = "NEW Dinner" />
<cfset arrSheets[ 3 ].ColumnList = "column1,column2,column3" />
<cfset arrSheets[ 3 ].ColumnNames = "Food,Quantity,Tastiness" />
 
 
<!---
	Now that we have our array of Sheet objects, we can write
	them to a new Excel file.
--->
<cfset objPOIUtility.WriteExcel(
	FilePath = ExpandPath( "./new_meals.xls" ),
	Sheets = arrSheets
	) />

For Cut-and-Paste