API Reference

Cmdlet

Clear-OfficeExcelComment

Aliases: ExcelCommentClear
Namespace PSWriteOffice
Aliases
ExcelCommentClear
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Int32

Clears legacy worksheet comments (notes) that match a filter.

Remarks

Clears legacy worksheet comments (notes) that match a filter.

Examples

Authored help example

Clear comments containing review text.

PS>


$removed = Clear-OfficeExcelComment -Path .\Report.xlsx -Sheet Data -TextContains review -Confirm:$false -PassThru
            Get-OfficeExcelCommentAudit -Path .\Report.xlsx -IncludeComments |
                Select-Object LegacyCommentCount, ThreadedCommentCount
        

Removes matching comments and saves the workbook.

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.

Syntax

Clear-OfficeExcelComment [-Address <String>] [-All] [-Author <String>] [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Context

Parameters

Address String optionalposition: namedpipeline: False
A1 cell address to match.
All SwitchParameter optionalposition: namedpipeline: False
Allow clearing all comments on the selected worksheet(s) when no filter is supplied.
Author String optionalposition: namedpipeline: False
Comment author to match, ignoring case.
PassThru SwitchParameter optionalposition: namedpipeline: False
Returns the number of comments cleared.
Range String optionalposition: namedpipeline: False
A1 cell or range to match.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
TextContains String optionalposition: namedpipeline: False
Text fragment to match, ignoring case.

Outputs

System.Int32

Clear-OfficeExcelComment [-Address <String>] [-All] [-Author <String>] -InputPath <String> [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Path

Parameters

Address String optionalposition: namedpipeline: False
A1 cell address to match.
All SwitchParameter optionalposition: namedpipeline: False
Allow clearing all comments on the selected worksheet(s) when no filter is supplied.
Author String optionalposition: namedpipeline: False
Comment author to match, ignoring case.
InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Workbook path to update.
PassThru SwitchParameter optionalposition: namedpipeline: False
Returns the number of comments cleared.
Range String optionalposition: namedpipeline: False
A1 cell or range to match.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
TextContains String optionalposition: namedpipeline: False
Text fragment to match, ignoring case.

Outputs

System.Int32

Clear-OfficeExcelComment [-Address <String>] [-All] [-Author <String>] -Document <ExcelDocument> [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Address String optionalposition: namedpipeline: False
A1 cell address to match.
All SwitchParameter optionalposition: namedpipeline: False
Allow clearing all comments on the selected worksheet(s) when no filter is supplied.
Author String optionalposition: namedpipeline: False
Comment author to match, ignoring case.
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to update outside the DSL context.
PassThru SwitchParameter optionalposition: namedpipeline: False
Returns the number of comments cleared.
Range String optionalposition: namedpipeline: False
A1 cell or range to match.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
TextContains String optionalposition: namedpipeline: False
Text fragment to match, ignoring case.

Outputs

System.Int32