OfficeIMO

API Reference

Command

Set-OfficeExcelMargins

Namespace PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Object

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: Context

Parameters

Bottom Nullable`1 optionalposition: namedpipeline: False
Bottom margin in inches.
Footer Nullable`1 optionalposition: namedpipeline: False
Footer margin in inches.
Header Nullable`1 optionalposition: namedpipeline: False
Header margin in inches.
Left Nullable`1 optionalposition: namedpipeline: False
Left margin in inches.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after applying margins.
Preset Nullable`1 optionalposition: namedpipeline: False
Margin preset to apply.
Right Nullable`1 optionalposition: namedpipeline: False
Right margin in inches.
Top Nullable`1 optionalposition: namedpipeline: False
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: Document

Parameters

Bottom Nullable`1 optionalposition: namedpipeline: False
Bottom margin in inches.
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
Footer Nullable`1 optionalposition: namedpipeline: False
Footer margin in inches.
Header Nullable`1 optionalposition: namedpipeline: False
Header margin in inches.
Left Nullable`1 optionalposition: namedpipeline: False
Left margin in inches.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after applying margins.
Preset Nullable`1 optionalposition: namedpipeline: False
Margin preset to apply.
Right Nullable`1 optionalposition: namedpipeline: False
Right margin in inches.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.
Top Nullable`1 optionalposition: namedpipeline: False
Top margin in inches.

Outputs

System.Object