Whatever message this page gives is out now! Go check it out!

spreadsheetAddPrintGridlines

Last update:
May 18, 2026

Description

Adds print gridlines between all rows and columns of the sheet from the spreadsheet object. The purpose of adding print gridlines to a spreadsheet is to ensure that the document prints in an organized, readable, and professional manner.

Returns

None

History

  • ColdFusion (2025 release): Added the function.

Syntax

spreadsheetAddPrintGridlines(spreadSheetObject,sheetName)

Parameters

Name
Required
Type
Description
spreadSheetObject
Yes
ExcelInfo
The Excel spreadsheet object to which you’ll add the gridlines.
sheetName
No
String
The sheet in which you’ll add the gridlines. If you do not specify a sheetName, the function adds gridlines to the active sheet.

Example

<cfquery name="art" datasource="cfartgallery">
    SELECT * FROM ART
</cfquery>
<cfscript>
    theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art-gridline.xls";
    // create a spreadsheet object
    theSheet=spreadsheetNew("SampleData")
    // add second sheet
    spreadSheetCreateSheet(theSheet, "Sheet2")
    // add rows from the table to the spreadsheet
    spreadsheetAddRows(theSheet,art)
    // add print gridlines
    try{
        spreadsheetAddPrintGridlines(theSheet,"Sheet2")
    }
    catch (any e){
        writeOutput(e.message)
    }
    // remove print gridlines
    spreadsheetRemovePrintGridlines(theSheet)
    // write spreadsheet
    spreadSheetWrite(theSheet,theFile,"yes")
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page