I'm happily using the Simplicity Spreadsheet.cfc b...
# cfml-general
d
I'm happily using the Simplicity Spreadsheet.cfc but when formatting the first row as a yellow-backgrounded bold row, I only can get the last two columns to accept the format. commonFormat = { bold: true, fgcolor: "yellow" }; apptReportSpreadsheet.FormatCellRange(spObj,commonFormat,1,1,1,6); This results in only the sixth column receiving the format.
c
I can't replicate that with a simple 6 column x 1 row sheet:
Copy code
spreadsheet = new spreadsheetCFML.SpreadSheet()
wb = spreadsheet.newXlsx()
data = [ [ "col1", "col2", "col3", "col4", "col5", "col6" ] ]
commonFormat = { bold: true, fgcolor: "yellow" }
spreadsheet
  .addRows( wb, data )
  .formatCellRange( wb, commonFormat, 1, 1, 1, 6 )
  .download( wb, "test" )
Can you provide a sample of the sheet data that you are trying to apply the format to?
1
d
Sorry I've been away from this. When you say sheet data, what can I provide you? I'm not sure what you're asking.
I've currently returned to this.
And, I've had success! Initially, I was trying to do the formatting on the first row prior to filling the data. I've now moved the command to AFTER the data has been applied to the entire sheet and I have success! From (before filling the data): commonFormat = { bold: true, fgcolor: "yellow" }; for(i=1;i lte listlen(excellist);i=i+1){ apptReportSpreadsheet.SetCellValue(spObj,"#listgetat(excellist,i)#",1,i); apptReportSpreadsheet.FormatCell(spObj,commonFormat,1,i); } To (after the filling of data, just before the write): apptReportSpreadsheet.FormatRow(spObj,{ bold: true, fgcolor: "yellow" },1); for (var col = 1; col <= dataTypeColumnCounter; col++) { apptReportSpreadsheet.AutoSizeColumn(spObj, col); } apptReportSpreadsheet.Write(spObj,"#strDir#/#filename#","yes"); I know this isn't very helpful and really points to something in the data, but I wanted to let you know we have a working solution in production.
c
It's generally best to format cells after you've added their data because adding data can force cells to be recreated and thereby lose any existing formatting. Depends how you're adding the data.
1