A function to add page breaks for rows and columns to a Spreadsheet Object.

spreadsheetAddPagebreaks(SpreadsheetObj, rowbreaks, colbreaks) → returns void

This function requires Adobe ColdFusion 11 and up.  Not supported on Lucee, etc.

Argument Reference

SpreadsheetObj any

Excel spreadsheet object to apply page break to.

rowbreaks string

Comma-delimited row numbers where the page breaks will be applied.

colbreaks string

Comma-delimited column numbers where the page breaks will be applied.

Sample code invoking the spreadsheetAddPagebreaks function

CF 11+ Here,we've example to break the excel using spreadsheetaddpagebreaks. It is supported only in adobe coldfusion.

<cfset Detail=SpreadsheetNew("student",false)>
<cfset SpreadSheetAddRow(Detail,"id,Name,Department,marks,average")>
<cfset SpreadSheetAddRow(Detail,"1,Dhar,CS,500,50")>
<cfset SpreadSheetAddRow(Detail,"2,DharC,EEE,600,85")>
<cfset SpreadSheetAddRow(Detail,"3,DharCf,EC,700,90")>
<cfset spreadsheetAddPagebreaks(Detail,'1,2', '3,4')>
<cfset SpreadsheetWrite(Detail,expandPath("./Detail.xls"),true)>

Fork me on GitHub