Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Get-OfficePowerPointLayoutBox

Aliases: PptLayoutBox
Module
PSWriteOffice
Aliases
PptLayoutBox
Inputs
OfficeIMO.PowerPoint.PowerPointPresentation
Outputs
OfficeIMO.PowerPoint.PowerPointLayoutBox

Computes reusable layout boxes for a presentation.

Syntax

Get-OfficePowerPointLayoutBox
[-MarginCm <Double>]
[-Presentation <PowerPointPresentation>]
[<CommonParameters>]
#
Parameter set: Content
Get-OfficePowerPointLayoutBox
-ColumnCount <Int32>
[-GutterCm <Double>]
[-MarginCm <Double>]
[-Presentation <PowerPointPresentation>]
[<CommonParameters>]
#
Parameter set: Columns
Get-OfficePowerPointLayoutBox
[-GutterCm <Double>]
[-MarginCm <Double>]
[-Presentation <PowerPointPresentation>]
-RowCount <Int32>
[<CommonParameters>]
#
Parameter set: Rows

Description

Returns the content box for a slide or equal column/row boxes derived from the current slide size.

Examples

Get the content area for a deck.

New-OfficePowerPoint -Path .\Examples\Documents\PowerPointLayoutBox.pptx {
    $slide = Add-OfficePowerPointSlide -Layout 1 -PassThru
    $box = Get-OfficePowerPointLayoutBox -MarginCm 1.5
    Add-OfficePowerPointTextBox -Slide $slide -Text 'Inside the content box' -X ($box.LeftPoints) -Y ($box.TopPoints) -Width ($box.WidthPoints) -Height 60
}

Returns a content box and uses it to position slide text.

Split the slide into two columns.

New-OfficePowerPoint -Path .\Examples\Documents\PowerPointColumns.pptx {
    $slide = Add-OfficePowerPointSlide -Layout 1 -PassThru
    $columns = Get-OfficePowerPointLayoutBox -ColumnCount 2 -MarginCm 1.5 -GutterCm 1.0
    Add-OfficePowerPointTextBox -Slide $slide -Text 'Left column' -X ($columns[0].LeftPoints) -Y ($columns[0].TopPoints) -Width ($columns[0].WidthPoints) -Height 80
    Add-OfficePowerPointTextBox -Slide $slide -Text 'Right column' -X ($columns[1].LeftPoints) -Y ($columns[1].TopPoints) -Width ($columns[1].WidthPoints) -Height 80
}

Uses two layout boxes to place text in columns.

Parameters

-MarginCm Double optional
Outer slide margin in centimeters.
-Presentation PowerPointPresentation optionalpipeline: True (ByValue)
Presentation to inspect (optional inside DSL).
-ColumnCount Int32 requiredsets: Columns
Number of columns to generate.
-GutterCm Double optionalsets: Columns, Rows
Column or row gutter in centimeters.
-RowCount Int32 requiredsets: Rows
Number of rows to generate.

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.