Rob Geissler
Rob Geissler

Reputation: 41

CFSpreadsheet loses SpreadSheetAddFreezePane when updating

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#"> 

Upvotes: 2

Views: 565

Answers (1)

Leigh
Leigh

Reputation: 28873

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).

Upvotes: 1

Related Questions