Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Set-OfficeExcelOrientation

Aliases: ExcelOrientation
Namespace PSWriteOffice
Aliases
ExcelOrientation
Inputs
OfficeIMO.Excel.ExcelDocument

Sets the page orientation on a worksheet.

Remarks

Sets the page orientation on a worksheet.

Examples

Authored help example

Switch to landscape orientation.

PS>


ExcelSheet 'Data' { Set-OfficeExcelOrientation -Orientation Landscape }
        

Configures the sheet to print in landscape.

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

Set-OfficeExcelOrientation -Orientation <Portrait|Landscape> [-PassThru] [<CommonParameters>]
#
Parameter set: Context

Parameters

Orientation OfficePageOrientation requiredposition: 0pipeline: Falsevalues: 2
Orientation to apply.
Possible values: Portrait, Landscape
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after applying the orientation.
Set-OfficeExcelOrientation -Document <ExcelDocument> -Orientation <Portrait|Landscape> [-PassThru] [-Sheet <String>] [-SheetIndex <Int32>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
Orientation OfficePageOrientation requiredposition: 0pipeline: Falsevalues: 2
Orientation to apply.
Possible values: Portrait, Landscape
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after applying the orientation.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.