There is a way to name and create individual reports - you have to use POI
from Apache.  If you are on CFMX 6.1 you need to download it, but if you are
on CFMX 7 then you can use POI straight out of the box!

http://jakarta.apache.org/poi/index.html

Do not go down the HTML route its crap - slow and cumbersome.  

With POI you can do the following (this is straight out of my code so wont
work straight off but you get the idea).  You can also merge columns
etc...very powerful.


// begin Java / Excel stuff
        workBook =
createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init();
        workSheet = workBook.createSheet();
        workBook.setSheetName(0, "Sheet Name");

        // Add headings row, bold, underline
        font = workBook.createFont();
        font.setBoldweight(font.BOLDWEIGHT_BOLD);
        style = workBook.createCellStyle();
        style.setFont(font);
        style.setWrapText(false);

        // Add headings row, bold, underline
        row = workSheet.createRow(0);
        font.setUnderline(true);
        style.setFont(font);
        for (i=1; i LTE ArrayLen(aColumns); i=i+1) {
                cell = row.createCell(Evaluate(i-1));
                cell.setCellvalue(aColumns[i].ColumnDesc);
                cell.setCellStyle(style);
                // set width, supposedly in units of 1/256 of character
width
                workSheet.setColumnWidth(Evaluate(i-1),
Evaluate((Len(ListFirst(aColumns[i].ColumnDesc, " ")) + 2) * 256));
        }

        // Add data from query in session
        for (j=1; j LTE session.rsExhibitorData.RecordCount; j=j+1) {
                row = workSheet.createRow(Evaluate(j));
                for (i=1; i LTE ArrayLen(aColumns); i=i+1) {
                        cell = row.createCell(Evaluate(i-1));
                        // add data
        
cell.setCellvalue(session.rsExhibitorData[aColumns[i].ColumnName][j]);

                }
        }

        filename = GetDirectoryFromPath(GetCurrentTemplatePath()) &
CreateUUID() & ".xls";
        fileOutStream =
createObject("java","java.io.FileOutputStream").init(filename);
        workBook.write(fileOutStream);
        fileOutStream.close();

        zipfilename = "report_" &
DateFormat(CreateDate(year(now()),month(now()),day(now())),"mm_dd_yyyy") &
".zip";
        // zip up
        ZipFileNew(expandPath("#zipfilename#"),filename);









-----Original Message-----
From: Kevin Penny [mailto:[EMAIL PROTECTED] 
Sent: 21 July 2005 19:33
To: CF-Talk
Subject: RE: cfcontent - for an excel file

I don't believe there is a way to 
create separate worksheets w/in the Document nor specify alternate worksheet
names.

I've looked into this before - and that was the conclusion I came up with .

Maybe if cfmx suppors excel in the reports - this could be built into it??

Kevin Penny
HotGigs.com


-----Original Message-----
From: Jill Robin Pascua [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 21, 2005 1:22 PM
To: CF-Talk
Subject: cfcontent - for an excel file

I'm creating a dynamic excel file using:

<cfheader name="Content-Disposition" value="attachment; filename=blah.xls">
<cfcontent type="application/msexcel">

I have only one worksheet.  Is there a way to specify the name the
worksheet or will the worksheet always match the filename?

Thanks,
- JR





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212495
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to