Set-SLBuiltinCellStyle


Synopsis

Apply a style based on the built-in cellstyles.

Syntax

Description

Apply a style based on the built-in cellstyles.
Applying a cell style will replace any existing cell formatting except for text alignment.
You may not want to use cell styles if you&;39;ve already added custom formatting to a cell or cells.

Parameters

-WorkBookInstance

Instance of an excel document that can be used for editing.

Required? True
Position? 0
Default value  
Accept pipeline input? true (ByValue)
Accept wildcard characters? False

-WorksheetName

Name of the Worksheet that is to be processed.

Required? False
Position? 1
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-CellReference

The target cell that needs to have the specified cellstyle. Eg: A5 or AB10

Required? True
Position? 2
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-CellStyle

Use tab completion or intellisense to select a possible value from a list provided by the parameter.
&;39;Normal&;39;,&;39;Bad&;39;,&;39;Good&;39;,&;39;Neutral&;39;,&;39;Calculation&;39;,&;39;CheckCell&;39;,&;39;ExplanatoryText&;39;,&;39;Input&;39;,&;39;LinkedCell&;39;,&;39;Note&;39;,&;39;Output&;39;,&;39;WarningText&;39;,
&;39;Heading1&;39;,&;39;Heading2&;39;,&;39;Heading3&;39;,&;39;Heading4&;39;,&;39;Title&;39;,&;39;Total&;39;,&;39;Accent1&;39;,&;39;Accent2&;39;,&;39;Accent3&;39;,&;39;Accent4&;39;,&;39;Accent5&;39;,&;39;Accent6&;39;,
&;39;Accent1Percentage60&;39;,&;39;Accent2Percentage60&;39;,&;39;Accent3Percentage60&;39;,&;39;Accent4Percentage60&;39;,&;39;Accent5Percentage60&;39;,&;39;Accent6Percentage60&;39;,
&;39;Accent1Percentage40&;39;,&;39;Accent2Percentage40&;39;,&;39;Accent3Percentage40&;39;,&;39;Accent4Percentage40&;39;,&;39;Accent5Percentage40&;39;,&;39;Accent6Percentage40&;39;,
&;39;Accent1Percentage20&;39;,&;39;Accent2Percentage20&;39;,&;39;Accent3Percentage20&;39;,&;39;Accent4Percentage20&;39;,&;39;Accent5Percentage20&;39;,&;39;Accent6Percentage20&;39;,
&;39;Comma&;39;,&;39;Comma0&;39;,&;39;Currency&;39;,&;39;Currency0&;39;,&;39;Percentage&;39;

Required? True
Position? 3
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-Range

The target cell range that needs to have the specified cellstyle. Eg: A5:B10 or AB10:AD20

Required? True
Position? 2
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

String,SpreadsheetLight.SLDocument

Outputs

SpreadsheetLight.SLDocument

Notes

Examples

Example 1

Apply a cellstyle anmed &;39;Accent2&;39; to cells B6,C6,D6.

Example 2

Apply different cellstyles to a set of cell ranges.
Note: save-sldocument is called in the last step i.e., after we apply all styles the final step is to save the document.

Example 3

Same as the previous example except that here we use the pipe to apply various styles.
Note: This is more efficient because it avoids the additional step of assigning the instance to a variable and then piping that variable to apply the style.

Related links