Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficeExcelHeader

Aliases: ExcelHeader
Module
PSWriteOffice
Aliases
ExcelHeader
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
OfficeIMO.Excel.ExcelSheet

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: Text
Set-OfficeExcelHeader
[-Center <String>]
[-DifferentFirstPage]
[-DifferentOddEven]
[-Document <ExcelDocument>]
[-ImageHeight <OfficeLength>]
-ImagePath <String>
[-ImagePosition <Left|Center|Right>]
[-ImageWidth <OfficeLength>]
[-Left <String>]
[-NoAlignWithMargins]
[-NoScaleWithDocument]
[-PassThru]
[-Right <String>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: ImagePath
Set-OfficeExcelHeader
[-Center <String>]
[-DifferentFirstPage]
[-DifferentOddEven]
[-Document <ExcelDocument>]
[-ImageHeight <OfficeLength>]
[-ImagePosition <Left|Center|Right>]
-ImageUrl <Uri>
[-ImageWidth <OfficeLength>]
[-Left <String>]
[-NoAlignWithMargins]
[-NoScaleWithDocument]
[-PassThru]
[-Right <String>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: ImageUrl

Examples

Add a report title.

ExcelSheet 'Data' { ExcelHeader -Center 'Quarterly review' }

Parameters

-Center String optional
Center section; Excel field codes such as &P and &N remain active.
-DifferentFirstPage SwitchParameter optional
Enable a first-page variant; explicitly false disables it without deleting authored variant text.
-DifferentOddEven SwitchParameter optional
Enable odd/even variants; omission retains the setting.
-Document ExcelDocument optionalpipeline: True (ByValue)
Caller-owned workbook; omission uses the enclosing Excel content block.
-Left String optional
Left section; empty text clears it, omission preserves it.
-NoAlignWithMargins SwitchParameter optional
Disable alignment with page margins; explicitly false restores alignment.
-NoScaleWithDocument SwitchParameter optional
Disable scaling with the printed worksheet; explicitly false restores scaling.
-PassThru SwitchParameter optional
Emit the updated caller-owned worksheet.
-Right String optional
Right section; empty text clears it, omission preserves it.
-Sheet OfficeSheetSelector optional
Worksheet name, one-based position or native worksheet.
-ImageHeight OfficeLength optionalsets: ImagePath, ImageUrl
Physical image height; a bare number means points.
-ImagePath String requiredsets: ImagePath
Literal local image file.
-ImagePosition ExcelHeaderFooterPosition optionalsets: ImagePath, ImageUrl
Image section; defaults to Right.
Possible values: Left, Center, Right
-ImageWidth OfficeLength optionalsets: ImagePath, ImageUrl
Physical image width; a bare number means points.
-ImageUrl Uri requiredsets: ImageUrl
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.