API Reference
Command
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 <Nullable`1>] [-Footer <Nullable`1>] [-Header <Nullable`1>] [-Left <Nullable`1>] [-PassThru] [-Preset <Nullable`1>] [-Right <Nullable`1>] [-Top <Nullable`1>] [<CommonParameters>]#Parameter set:
ContextParameters
- Bottom Nullable`1
- Bottom margin in inches.
- Footer Nullable`1
- Footer margin in inches.
- Header Nullable`1
- Header margin in inches.
- Left Nullable`1
- Left margin in inches.
- PassThru SwitchParameter
- Emit the worksheet after applying margins.
- Preset Nullable`1
- Margin preset to apply.
- Right Nullable`1
- Right margin in inches.
- Top Nullable`1
- Top margin in inches.
Outputs
System.Object
Set-OfficeExcelMargins [-Bottom <Nullable`1>] -Document <ExcelDocument> [-Footer <Nullable`1>] [-Header <Nullable`1>] [-Left <Nullable`1>] [-PassThru] [-Preset <Nullable`1>] [-Right <Nullable`1>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-Top <Nullable`1>] [<CommonParameters>]#Parameter set:
DocumentParameters
- Bottom Nullable`1
- Bottom margin in inches.
- Document ExcelDocument
- Workbook to operate on outside the DSL context.
- Footer Nullable`1
- Footer margin in inches.
- Header Nullable`1
- Header margin in inches.
- Left Nullable`1
- Left margin in inches.
- PassThru SwitchParameter
- Emit the worksheet after applying margins.
- Preset Nullable`1
- Margin preset to apply.
- Right Nullable`1
- Right margin in inches.
- Sheet String
- Worksheet name when using Document.
- SheetIndex Nullable`1
- Worksheet index (0-based) when using Document.
- Top Nullable`1
- Top margin in inches.
Outputs
System.Object