Cmdlet
Add-OfficeExcelTableOfContents
Adds or refreshes a table-of-contents sheet with links to every sheet.
Syntax
Add-OfficeExcelTableOfContents
[-BackLink]
[-BackLinkAddress <String>]
[-BackLinkText <String>]
[-Document <ExcelDocument>]
[-IncludeHiddenNamedRanges]
[-IncludeNamedRanges]
[-Name <String>]
[-NoHyperlinks]
[-NoMoveFirst]
[-NoStyle]
[-PassThru]
[<CommonParameters>]#Parameter set:
DefaultExamples
Add a contents sheet
Open-OfficeExcel -Path .\Reports\Board-Pack.xlsx {
ExcelTableOfContents
}Adds a first sheet with a link to every other sheet.
Build a navigable report pack
$orders = Import-OfficeCsv -Path .\Data\Q3-Orders.csv
New-OfficeExcel -Path .\Reports\Q3-Regions.xlsx {
foreach ($group in $orders | Group-Object Region) {
ExcelSheet $group.Name {
ExcelTable $group.Group -Address A3
}
}
ExcelTableOfContents -Name 'Contents' -BackLink -BackLinkAddress A1 -BackLinkText 'Back to contents'
}Writes one sheet per region, then adds a contents sheet with links and a back link on each regional sheet.
Parameters
- -BackLink SwitchParameter
- Adds a link from each listed worksheet back to the table of contents.
- -BackLinkAddress String
- A1 destination for worksheet back links; omission chooses an unused cell.
- -BackLinkText String
- Text used for back links.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- Include hidden named ranges when listing named ranges.
- -IncludeNamedRanges SwitchParameter
- Include named ranges in the TOC.
- -Name String
- Named range name.
- -NoHyperlinks SwitchParameter
- Disable internal hyperlinks in the TOC sheet.
- -NoMoveFirst SwitchParameter
- Keeps the table-of-contents worksheet at its current position.
- -NoStyle SwitchParameter
- Disable formatted TOC styling.
- -PassThru SwitchParameter
- Emits the native result after the operation.
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.