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-OfficeExcelPageSetup

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

Configures page setup options on a worksheet.

Remarks

Configures page setup options on a worksheet.

Examples

Authored help example

Fit to one page wide.

PS>


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

Fits the sheet to one page wide and unlimited height.

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-OfficeExcelPageSetup [-FitToHeight <UInt32>] [-FitToWidth <UInt32>] [-PageOrder <DownThenOver|OverThenDown>] [-PassThru] [-Scale <UInt32>] [<CommonParameters>]
#
Parameter set: Context

Parameters

FitToHeight UInt32 optionalposition: namedpipeline: False
Number of pages to fit vertically.
FitToWidth UInt32 optionalposition: namedpipeline: False
Number of pages to fit horizontally.
PageOrder ExcelPageOrder optionalposition: namedpipeline: Falsevalues: 2
Multi-page print order.
Possible values: DownThenOver, OverThenDown
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after applying settings.
Scale UInt32 optionalposition: namedpipeline: False
Manual scale percentage (10-400).
Set-OfficeExcelPageSetup -Document <ExcelDocument> [-FitToHeight <UInt32>] [-FitToWidth <UInt32>] [-PageOrder <DownThenOver|OverThenDown>] [-PassThru] [-Scale <UInt32>] [-Sheet <String>] [-SheetIndex <Int32>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
FitToHeight UInt32 optionalposition: namedpipeline: False
Number of pages to fit vertically.
FitToWidth UInt32 optionalposition: namedpipeline: False
Number of pages to fit horizontally.
PageOrder ExcelPageOrder optionalposition: namedpipeline: Falsevalues: 2
Multi-page print order.
Possible values: DownThenOver, OverThenDown
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after applying settings.
Scale UInt32 optionalposition: namedpipeline: False
Manual scale percentage (10-400).
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.