Description
Set the print orientation of a sheet to landscape or portrait. By default, applies to currently active sheet.
Returns
None
History
ColdFusion (2025 release): Added the function.
Syntax
spreadsheetSetPrintOrientation(spreadSheetObject, orientation, sheetName)
Parameters
Name
|
Required
|
Type
|
Description
|
spreadSheetObject
|
Yes
|
ExcelInfo
|
The Excel spreadsheet object to which you must set the print orientation to landscape or portrait.
|
orientation
|
Yes
|
String
|
Specify one of the following:
|
sheetName
|
No
|
String
|
The sheet to which you must set the print orientation. If you do not provide sheetName, the function will choose the default sheet in the workbook related to value passed for the first parameter.
|
Example
<cfquery name="art" datasource="cfartgallery"> SELECT * FROM ART </cfquery> <cfscript> theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art-file.xls"; // create a spreadsheet object theSheet=spreadsheetNew("SampleData") // add rows from the table to the spreadsheet spreadsheetAddRows(theSheet,art) // set print orientation try{ spreadsheetSetPrintOrientation(theSheet,"portrait","SampleData") writeOutput("Print orientation set successfully" & "<br/>") } catch (any e){ writeOutput(e.message) } // get the print orientation getOrientation=spreadsheetGetPrintOrientation(theSheet) writeOutput("Print orientation is: " & getOrientation) </cfscript>