# Set-OfficeExcelPageSetup

Configures page setup options 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: ExcelPageSetup

**Module**

`PSWriteOffice`

**Aliases**

`ExcelPageSetup`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[SetOfficeExcelPageSetupCommand.cs:16](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelPageSetupCommand.cs#L16) 

Configures page setup options on a worksheet.

## Syntax

```
Set-OfficeExcelPageSetup
[-FitToHeight <UInt32>]
[-FitToWidth <UInt32>]
[-PageOrder <DownThenOver|OverThenDown>]
[-PassThru]
[-Scale <UInt32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelpagesetup-uint32-uint32-excelpageorder-switchparameter-uint32)

Parameter set: `Context`

```
Set-OfficeExcelPageSetup
-Document <ExcelDocument>
[-FitToHeight <UInt32>]
[-FitToWidth <UInt32>]
[-PageOrder <DownThenOver|OverThenDown>]
[-PassThru]
[-Scale <UInt32>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelpagesetup-exceldocument-uint32-uint32-excelpageorder-switchparameter-uint32-string-int32)

Parameter set: `Document`

## Examples

### Fit to one page wide.

```powershell
ExcelSheet 'Data' { Set-OfficeExcelPageSetup -FitToWidth 1 -FitToHeight 0 }
```

Fits the sheet to one page wide and unlimited height.

## Parameters

**-FitToHeight UInt32 optional**

Number of pages to fit vertically.

**-FitToWidth UInt32 optional**

Number of pages to fit horizontally.

**-PageOrder ExcelPageOrder optional**

Multi-page print order.

Possible values: `DownThenOver`, `OverThenDown`

**-PassThru SwitchParameter optional**

Emit the worksheet after applying settings.

**-Scale UInt32 optional**

Manual scale percentage (10-400).

**-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:F5BA931B45C9CC11873648648E1FC116E23544295A63EE327816D0D54E05E2D7 -->
