Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Get-OfficeExcelRichText

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument System.String[]

Gets the rich-text runs of a cell.

Syntax

Get-OfficeExcelRichText
-Address <String>
[-Document <ExcelDocument>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: Document
Get-OfficeExcelRichText
-Address <String>
[-Path] <String[]>
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: Path
Get-OfficeExcelRichText
-Address <String>
-LiteralPath <String[]>
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: LiteralPath

Examples

Read the text runs of a cell

Get-OfficeExcelRichText -Path .\Reports\Migration.xlsx -Sheet Overview -Address B3

Returns each formatted run of B3 on the Overview sheet.

Find the bold parts of a status cell

$book = Open-OfficeExcel -Path .\Reports\Status.xlsx -ReadOnly
Get-OfficeExcelRichText -Document $book -Sheet Summary -Address B2 | Where-Object Bold
Close-OfficeExcel -Document $book

Reads the runs of a status cell from an open workbook and keeps only the bold text.

Parameters

-Address String required
A1 address of the target cell.
-Document ExcelDocument optionalpipeline: True (ByValue)sets: Document
Caller-owned workbook; omission uses the enclosing Excel content block.
-Sheet OfficeSheetSelector optionalaliases: WorksheetName
Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
-Path String[] requiredposition: 0pipeline: True (ByValue)aliases: FilePathsets: Path
Workbook paths resolved with filesystem wildcard support.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
Literal workbook paths, including FileInfo.FullName and provider PSPath.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.