Cmdlet
Set-OfficeExcelMargins
Sets page margins on a worksheet.
Syntax
Set-OfficeExcelMargins
[-Bottom <Double>]
[-Footer <Double>]
[-Header <Double>]
[-Left <Double>]
[-PassThru]
[-Preset <Normal| Narrow| Moderate| Wide>]
[-Right <Double>]
[-Top <Double>]
[<CommonParameters>]#Parameter set:
ContextSet-OfficeExcelMargins
[-Bottom <Double>]
-Document <ExcelDocument>
[-Footer <Double>]
[-Header <Double>]
[-Left <Double>]
[-PassThru]
[-Preset <Normal| Narrow| Moderate| Wide>]
[-Right <Double>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Top <Double>]
[<CommonParameters>]#Parameter set:
DocumentExamples
Apply a preset margin set.
ExcelSheet 'Data' { Set-OfficeExcelMargins -Preset Narrow }Applies the Narrow margin preset.
Apply custom margins.
ExcelSheet 'Data' { Set-OfficeExcelMargins -Left 0.5 -Right 0.5 -Top 0.75 -Bottom 0.75 }Sets custom margins in inches.
Parameters
- -Bottom Double
- Bottom margin in inches.
- Footer margin in inches.
- -Header Double
- Header margin in inches.
- -Left Double
- Left margin in inches.
- -PassThru SwitchParameter
- Emit the worksheet after applying margins.
- -Preset ExcelMarginPreset
- Margin preset to apply.
- Possible values:
Normal,Narrow,Moderate,Wide - -Right Double
- Right margin in inches.
- -Top Double
- Top margin in inches.
- -Document ExcelDocument
- Workbook to operate on outside the DSL context.
- -Sheet String
- Worksheet name when using Document.
- -SheetIndex Int32
- 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.