# Test-OfficeAccessibility

Checks Word, Excel and PowerPoint files for accessibility issues. The input is never changed.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`System.String[]`

**Outputs**

`PSWriteOffice.Models.OfficeAccessibilityFileReport` `System.String` `System.Boolean`

**Source**

[TestOfficeAccessibilityCommand.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Accessibility/TestOfficeAccessibilityCommand.cs#L34) 

Checks Word, Excel and PowerPoint files for accessibility issues. The input is never changed.

## Syntax

```
Test-OfficeAccessibility
[-IncludeWarnings]
[-Password <SecureString>]
[-Path] <String[]>
[-Quiet]
[-Sarif]
[-Strict]
[<CommonParameters>]
```

[#](#method-test-officeaccessibility-switchparameter-securestring-string-switchparameter-switchparameter-switchparameter)

Parameter set: `Path`

```
Test-OfficeAccessibility
[-IncludeWarnings]
-LiteralPath <String[]>
[-Password <SecureString>]
[-Quiet]
[-Sarif]
[-Strict]
[<CommonParameters>]
```

[#](#method-test-officeaccessibility-switchparameter-string-securestring-switchparameter-switchparameter-switchparameter)

Parameter set: `LiteralPath`

```
Test-OfficeAccessibility
-Document <Object>
[-IncludeWarnings]
[-Quiet]
[-Sarif]
[-Strict]
[<CommonParameters>]
```

[#](#method-test-officeaccessibility-object-switchparameter-switchparameter-switchparameter-switchparameter)

Parameter set: `Document`

## Description

Runs the rules of the Office Accessibility Checker: alternative text, table header rows, document title and language, headings, hyperlink text, text contrast, slide titles, merged cells, default and hidden sheets, and blank cells or paragraphs used for spacing. All three formats return the same finding codes and severities. Strict turns structural warnings into errors and requires a document title; heuristic findings stay warnings.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Check accessibility](/docs/before-sharing/accessibility/) Guide
  
  Check Word, Excel and PowerPoint files for missing alt text, table headers, unclear links, low contrast, title and language, and write SARIF for CI.

## Examples

### List the accessibility findings of a workbook.

```powershell
(Test-OfficeAccessibility -Path .\Budget.xlsx).Findings | Format-Table Severity, Code, Location, Message
```

### Fail a build when any document in a folder has accessibility errors.

```powershell
$failed = Get-ChildItem .\Docs -Include *.docx, *.xlsx, *.pptx -Recurse | Test-OfficeAccessibility -Strict -ErrorAction Stop |
    Where-Object { -not $_.IsSuccessful }
if ($failed) { throw "Accessibility errors in $($failed.Count) document(s)." }
```

### Write a SARIF log for code-scanning tools.

```powershell
Test-OfficeAccessibility -Path .\Deck.pptx -Sarif | Set-Content .\Deck.sarif
```

## Parameters

**-IncludeWarnings SwitchParameter optional**

With Quiet, warnings also make the result false.

**-Password SecureString optionalsets: Path, LiteralPath**

Password for an encrypted path input. Accepts SecureString or PSCredential; plain strings are transformed with a warning.

**-Path String[] requiredposition: 0pipeline: True (ByValue)sets: Path**

Files to inspect; supports wildcards.

**-Quiet SwitchParameter optional**

Returns a Boolean per input: true when there are no errors (and no warnings with IncludeWarnings).

**-Sarif SwitchParameter optional**

Returns each report as a SARIF 2.1.0 log string instead of a report object.

**-Strict SwitchParameter optional**

Uses the strict profile: structural warnings become errors and a document title is required.

**-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath**

Exact file paths, including FileInfo.FullName and provider PSPath pipeline properties.

**-Document Object requiredsets: Document**

An open Word, Excel or PowerPoint document, including unsaved edits.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

## Outputs

PSWriteOffice.Models.OfficeAccessibilityFileReport: Accessibility findings for one Word, Excel or PowerPoint file or open document.

<!-- PowerForge markdown artifact sha256:1E855ED0027FC79C852B034F018233F4C833ADD7D57AD9FDFB3ADFADD9013930 -->
