# Add-OfficeExcelPageBreak

Adds manual print page breaks to an open worksheet.

Cmdlet 

Aliases: ExcelPageBreak

**Module**

`PSWriteOffice`

**Aliases**

`ExcelPageBreak`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`PSWriteOffice.Models.Excel.ExcelPageBreakInfo`

**Source**

[AddOfficeExcelPageBreakCommand.cs:40](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/AddOfficeExcelPageBreakCommand.cs#L40) 

Adds manual print page breaks to an open worksheet.

## Syntax

```
Add-OfficeExcelPageBreak
[-Column <Int32[]>]
[-Document <ExcelDocument>]
[-PassThru]
[-Row <Int32[]>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
```

[#](#method-add-officeexcelpagebreak-int32-exceldocument-switchparameter-int32-officesheetselector)

Parameter set: `Default`

## Examples

### Separate report sections when printing.

```powershell
ExcelSheet 'Data' { ExcelPageBreak -Row 25,50 -Column 8 }
```

### Break before a row

```powershell
Open-OfficeExcel -Path .\Reports\Inventory.xlsx {
    ExcelSheet 'Servers' {
        ExcelPageBreak -Row 41
    }
}
```

Starts a new printed page at row 41.

### Print each site on its own page

```powershell
$sites = Import-OfficeExcel -Path .\Reports\Inventory.xlsx -Sheet Servers
$firstRows = @()
$rowNumber = 2
foreach ($group in $sites | Group-Object Site) {
    if ($rowNumber -gt 2) { $firstRows += $rowNumber }
    $rowNumber += $group.Count
}
Open-OfficeExcel -Path .\Reports\Inventory.xlsx {
    ExcelSheet 'Servers' {
        ExcelPageBreak -Row $firstRows
    }
}
```

Adds a page break above the first row of each site block so every site starts on a new page.

## Parameters

**-Column Int32[] optional**

One-based columns after which printing starts a new page.

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Gets or sets an explicit live document; omission uses the enclosing content block.

**-PassThru SwitchParameter optional**

Emit the worksheet's page-break snapshots after adding the selected breaks.

**-Row Int32[] optional**

One-based rows after which printing starts a new page.

**-Sheet OfficeSheetSelector optionalaliases: WorksheetName**

Worksheet name, one-based position or native worksheet; omission uses the current sheet.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

## Outputs

PSWriteOffice.Models.Excel.ExcelPageBreakInfo: A manual print page-break snapshot that remains readable after its source workbook is closed.

<!-- PowerForge markdown artifact sha256:0AC394537057E8367560F13080A49C43242E9016EA233E9782442BD4C7AE4D03 -->
