API Reference

Cmdlet

Set-OfficeExcelPrintArea

Aliases: ExcelPrintArea
Namespace PSWriteOffice
Aliases
ExcelPrintArea
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Object

Sets the print area for a worksheet.

Remarks

Sets the print area for a worksheet.

Examples

Authored help example

Set a print area and keep the workbook printable.

PS>


$proof = @(
                Set-OfficeExcelPrintArea -Path .\Report.xlsx -Sheet Summary -Range A1:H40
                Set-OfficeExcelPrintTitles -Path .\Report.xlsx -Sheet Summary -FirstRow 1 -LastRow 2
            )
            $proof
        

Stores the worksheet-local Excel print area and repeats the report header rows for printing.

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-OfficeExcelPrintArea [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]
#
Parameter set: Context

Parameters

PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after setting the print area.
Range String requiredposition: 1pipeline: False
A1 range to print.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index when using a workbook object or path.

Outputs

System.Object

Set-OfficeExcelPrintArea -InputPath <String> [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]
#
Parameter set: Path

Parameters

InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Workbook path to update.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after setting the print area.
Range String requiredposition: 1pipeline: False
A1 range to print.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index when using a workbook object or path.

Outputs

System.Object

Set-OfficeExcelPrintArea -Document <ExcelDocument> [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to update outside the DSL context.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after setting the print area.
Range String requiredposition: 1pipeline: False
A1 range to print.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index when using a workbook object or path.

Outputs

System.Object