2

I am trying to add spreadsheets to a workbook with a freeze pane. The freeze pane will work if the action is write but not if I add another sheet using update.

<cfscript> 
theSheet = SpreadsheetNew(SheetName); 
SpreadsheetAddRows(theSheet,TheQuery); 
format2=StructNew();
format2.font="Arial"; 
format2.fontsize="10"; 
format2.color="Black;"; 
format2.italic="False"; 
format2.bold="true"; 
format2.alignment="left"; 
format2.textwrap="true"; 
format2.fgcolor="tan"; 
format2.bottomborder="thick"; 
format2.bottombordercolor="Black"; 
format2.leftborder="thick"; 
format2.leftbordercolor="Black"; 
format2.rightborder="thick"; 
format2.rightbordercolor="Black";  
SpreadsheetFormatRows(theSheet,format2,"1-2");
SpreadsheetFormatColumns(theSheet,format2,"1-3");
SpreadSheetAddFreezePane(theSheet,3,1);
</cfscript> 
<cfspreadsheet filename="#theFile#" name="theSheet" sheet="#SheetCount#" action="update" sheetname="#SheetName#"> 
Leigh
  • 28,765
  • 10
  • 55
  • 103

1 Answers1

1

Sounds like it could be a bug. Unless there is a specific reason for using action=update, I would just use action=write instead. Read in the workbook. Add a new sheet. Make it active. Then write it back to disk.

<cfscript> 
    theSheet = SpreadSheetRead( theFile );
    SpreadsheetCreateSheet( theSheet, sheetName );
    SpreadSheetSetActiveSheet( theSheet, sheetName );
    // ... code to add data 
    SpreadSheetAddFreezePane( theSheet, 3, 1 );
    SpreadSheetWrite( theSheet, theFile, true );
</cfscript> 

As Adam mentioned in the comments, you may want to file a bug report (and post the bug number here so others can vote on it).

Leigh
  • 28,765
  • 10
  • 55
  • 103
  • 1
    *And* you should raise a bug. @Leigh's is a good work-around, but it should work the way you initially attempted, too. – Adam Cameron Jan 04 '13 at 09:13