Cmdlet
Set-OfficeExcelHeader
Updates worksheet header text, print flags or an image while retaining the footer.
Syntax
Set-OfficeExcelHeader
[-Center <String>]
[-DifferentFirstPage]
[-DifferentOddEven]
[-Document <ExcelDocument>]
[-Left <String>]
[-NoAlignWithMargins]
[-NoScaleWithDocument]
[-PassThru]
[-Right <String>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]#Parameter set:
TextExamples
Add a report title.
ExcelSheet 'Data' { ExcelHeader -Center 'Quarterly review' }Parameters
- -Center String
- Center section; Excel field codes such as &P and &N remain active.
- -DifferentFirstPage SwitchParameter
- Enable a first-page variant; explicitly false disables it without deleting authored variant text.
- -DifferentOddEven SwitchParameter
- Enable odd/even variants; omission retains the setting.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -Left String
- Left section; empty text clears it, omission preserves it.
- -NoAlignWithMargins SwitchParameter
- Disable alignment with page margins; explicitly false restores alignment.
- -NoScaleWithDocument SwitchParameter
- Disable scaling with the printed worksheet; explicitly false restores scaling.
- -PassThru SwitchParameter
- Emit the updated caller-owned worksheet.
- -Right String
- Right section; empty text clears it, omission preserves it.
- -Sheet OfficeSheetSelector
- Worksheet name, one-based position or native worksheet.
- -ImageHeight OfficeLength
- Physical image height; a bare number means points.
- -ImagePath String
- Literal local image file.
- -ImagePosition ExcelHeaderFooterPosition
- Image section; defaults to Right.
- Possible values:
Left,Center,Right - -ImageWidth OfficeLength
- Physical image width; a bare number means points.
- -ImageUrl Uri
- HTTP or HTTPS image URL; existing native remote-image policy applies.
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.