# Set-OfficeExcelOrientation

Sets the page orientation on a worksheet. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelOrientation

**Module**

`PSWriteOffice`

**Aliases**

`ExcelOrientation`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[SetOfficeExcelOrientationCommand.cs:17](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelOrientationCommand.cs#L17) 

Sets the page orientation on a worksheet.

## Syntax

```
Set-OfficeExcelOrientation
[-Orientation] <Portrait|Landscape>
[-PassThru]
[<CommonParameters>]
```

[#](#method-set-officeexcelorientation-officepageorientation-switchparameter)

Parameter set: `Context`

```
Set-OfficeExcelOrientation
-Document <ExcelDocument>
[-Orientation] <Portrait|Landscape>
[-PassThru]
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelorientation-exceldocument-officepageorientation-switchparameter-string-int32)

Parameter set: `Document`

## Examples

### Switch to landscape orientation.

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

Configures the sheet to print in landscape.

## Parameters

**-Orientation OfficePageOrientation requiredposition: 0**

Orientation to apply.

Possible values: `Portrait`, `Landscape`

**-PassThru SwitchParameter optional**

Emit the worksheet after applying the orientation.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document**

Workbook to operate on outside the DSL context.

**-Sheet String optionalsets: Document**

Worksheet name when using Document.

**-SheetIndex Int32 optionalsets: Document**

Worksheet index (0-based) when using Document.

## 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).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:DEEAF6E139A1231BC73D706BDF02DB6BE295F9FC65967A3DC984793B7F2357EC -->
