Copy-SLCellStyle


Synopsis

Copy a style from a cell and apply it to another cell or a range of cells.

Syntax

Description

Copy a style from a cell and apply it to another cell or a range of cells.
Note: style can only be copied from a cell and not from a range of cells so the source is always going to be a single cell.
The target howver can be either a single cell or a range of cells.
#known issue – style is not applied if the style being copied is applied to another cell in the same row or column.
Eg: Copy style from G10 to G4 or from G10 to D10 will not work.

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

-FromCellReference

The source cell that contains the style to be copied. Eg: A5 or AB10

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

-ToCellReference

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

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 copied 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

Copy cellstyle from G9 and apply it to cell F3.

Example 2

Copy style from cell &;39;g10&;39; and apply to Cell Range &;39;f4:h6&;39;.

Related links