Last updated on
Feb 25, 2025
Description
Retrieves the format of a specified cell in a spreadsheet.
Returns
A struct with the following keys:
- alignment
- bgcolor
- bold
- bottomborder
- bottombordercolor
- dataformat
- fgcolor
- fillpattern
- font
- fontsize
- indent
- italic
- leftborder
- leftbordercolor
- rightborder
- rightbordercolor
- rotation
- strikeout
- topborder
- topbordercolor
- textwrap
- underlineverticalalignment
History
ColdFusion (2025 release): Added the function.
Syntax
spreadsheetGetCellFormat(spreadsheetObject,row,column)
spreadsheetGetCellFormat(spreadsheetObject,row,column)
spreadsheetGetCellFormat(spreadsheetObject,row,column)
Parameters
Name
|
Required
|
Type
|
Description
|
spreadSheetObject
|
Yes
|
ExcelInfo
|
The Excel spreadsheet object for which to get the cell format.
|
row
|
Yes
|
Integer
|
The row number of the cell.
|
column
|
Yes
|
Integer
|
The column number of the cell.
|
Example
<cfquery name="art" datasource="cfartgallery">
SELECT * FROM ART
</cfquery>
<cfscript>
theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art.xls";
// create a spreadsheet object
theSheet=spreadsheetNew("SampleData")
// add rows from query
spreadsheetAddRows(theSheet,art)
// writeOutput(theFile)
// Define the structure for formatting a cell
myFormat=StructNew();
myFormat.color="blue";
myFormat.bold="true";
myFormat.underline="true";
myFormat.alignment="center";
myFormat.rotation=45;
myFormat.italic="true"
// Set formatting to cell (10,5)
SpreadsheetFormatCell(theSheet,myFormat,11,5)
spreadsheetWrite(theSheet,theFile,"yes")
// get cell format
cellFormat=spreadsheetGetCellFormat(theSheet,11,5)
writeDump(cellFormat)
</cfscript>
<cfquery name="art" datasource="cfartgallery">
SELECT * FROM ART
</cfquery>
<cfscript>
theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art.xls";
// create a spreadsheet object
theSheet=spreadsheetNew("SampleData")
// add rows from query
spreadsheetAddRows(theSheet,art)
// writeOutput(theFile)
// Define the structure for formatting a cell
myFormat=StructNew();
myFormat.color="blue";
myFormat.bold="true";
myFormat.underline="true";
myFormat.alignment="center";
myFormat.rotation=45;
myFormat.italic="true"
// Set formatting to cell (10,5)
SpreadsheetFormatCell(theSheet,myFormat,11,5)
spreadsheetWrite(theSheet,theFile,"yes")
// get cell format
cellFormat=spreadsheetGetCellFormat(theSheet,11,5)
writeDump(cellFormat)
</cfscript>
<cfquery name="art" datasource="cfartgallery"> SELECT * FROM ART </cfquery> <cfscript> theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art.xls"; // create a spreadsheet object theSheet=spreadsheetNew("SampleData") // add rows from query spreadsheetAddRows(theSheet,art) // writeOutput(theFile) // Define the structure for formatting a cell myFormat=StructNew(); myFormat.color="blue"; myFormat.bold="true"; myFormat.underline="true"; myFormat.alignment="center"; myFormat.rotation=45; myFormat.italic="true" // Set formatting to cell (10,5) SpreadsheetFormatCell(theSheet,myFormat,11,5) spreadsheetWrite(theSheet,theFile,"yes") // get cell format cellFormat=spreadsheetGetCellFormat(theSheet,11,5) writeDump(cellFormat) </cfscript>