Cmdlet
Set-OfficeExcelPrintArea
Sets the print area for a worksheet.
Syntax
Set-OfficeExcelPrintArea
[-PassThru]
[-Range] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]#Parameter set:
ContextSet-OfficeExcelPrintArea
[-PassThru]
[-Path] <String>
[-Range] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]#Parameter set:
PathSet-OfficeExcelPrintArea
-Document <ExcelDocument>
[-PassThru]
[-Range] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]#Parameter set:
DocumentExamples
Set a print area and keep the workbook printable.
$proof = @(
Set-OfficeExcelPrintArea -Path .\Report.xlsx -Sheet Summary -Range A1:H40
Set-OfficeExcelPrintTitles -Path .\Report.xlsx -Sheet Summary -FirstRow 1 -LastRow 2
)
$proofStores the worksheet-local Excel print area and repeats the report header rows for printing.
Parameters
- -PassThru SwitchParameter
- Emit the worksheet after setting the print area.
- -Range String
- A1 range to print.
- -Sheet String
- Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- -SheetIndex Int32
- Worksheet index when using a workbook object or path.
- -Path String
- Workbook path to update.
- -Document ExcelDocument
- Workbook to update outside the DSL context.
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.