API Reference
Cmdlet
Set-OfficeExcelMargins
Sets page margins on a worksheet.
Remarks
Sets page margins on a worksheet.
Examples
Apply a preset margin set.
PS>
ExcelSheet 'Data' { Set-OfficeExcelMargins -Preset Narrow }
Applies the Narrow margin preset.
Apply custom margins.
PS>
ExcelSheet 'Data' { Set-OfficeExcelMargins -Left 0.5 -Right 0.5 -Top 0.75 -Bottom 0.75 }
Sets custom margins in inches.
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-OfficeExcelMargins [-Bottom <Double>] [-Footer <Double>] [-Header <Double>] [-Left <Double>] [-PassThru] [-Preset <Normal|Narrow|Moderate|Wide>] [-Right <Double>] [-Top <Double>] [<CommonParameters>]#Parameter set:
ContextParameters
- Bottom Double
- Bottom margin in inches.
- Footer Double
- 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.
Set-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:
DocumentParameters
- Bottom Double
- Bottom margin in inches.
- Document ExcelDocument
- Workbook to operate on outside the DSL context.
- Footer Double
- 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.
- Sheet String
- Worksheet name when using Document.
- SheetIndex Int32
- Worksheet index (0-based) when using Document.
- Top Double
- Top margin in inches.