Tuesday, December 1, 2026
HomePowershellConstruct an editable PowerPoint service transient from PowerShell

Construct an editable PowerPoint service transient from PowerShell


My first PowerPoint automation scripts knew the place and dimension of just about each form. They labored, however altering the structure meant altering a web page of coordinates, and each new slide copied a bit extra design data into the script.

The newer OfficeIMO designer APIs let me describe the slide as a substitute: this can be a course of, these are playing cards, and this part comprises the proof. The engine chooses the preliminary layouts and produces an editable .pptx. PSWriteOffice brings that mannequin into PowerShell whereas maintaining express chart, desk, notes, and form instructions for slides that want exact management.

This instance tells the story of constructing the PSWriteOffice examples. It turns supply steps, obligations, pattern metrics, and subsequent actions into an eight-slide deck. The Protection and Polish values are fictional chart knowledge, somewhat than product scores or a roadmap. Change them with service-health knowledge, undertaking standing, or one other briefing that belongs beside the Phrase and Excel reviews on this sequence.

Earlier than you begin

Use PowerShell 7 and set up the present public modules used for this text:

Set up-Module PSWriteOffice -Scope CurrentUser -Drive
Import-Module PSWriteOffice

Run the examples from a folder the place you’ll be able to write the generated recordsdata. Change the fictional values after the primary profitable run.

What the instance builds

The full showcase script lives within the PSWriteOffice repository. The blocks beneath construct its eight-slide compact model.

It creates a service transient deck with:

  • 16:9 slide dimension
  • branded accent coloration
  • OfficeIMO designer deck-plan rendering
  • part slide
  • course of slide
  • card-grid slide
  • protection/map-like slide
  • functionality slide
  • case-study slide
  • express chart slide
  • express desk slide
  • speaker notes
  • named sections
  • slide transitions
  • structural slide read-back

The deck stays editable. That’s what makes the instance helpful to me: PowerShell creates the primary strong model, and a presenter can nonetheless regulate the wording or transfer a form earlier than the assembly.

Deck plan first

I start with the data that belongs within the story: course of steps, product playing cards, protection areas, capabilities, and metrics.

$course of = @(
    [pscustomobject]@{
        Title="Evaluate"
        Description = 'Map PSWriteOffice towards OfficeIMO capabilities.'
        AccentColor="#008C95"
    }
    [pscustomobject]@{
        Title="Compose"
        Description = 'Create showcase scripts that generate actual artifacts.'
        AccentColor="#3B82F6"
    }
    [pscustomobject]@{
        Title="Publish"
        Description = 'Use screenshots, code, and blogs to elucidate the output.'
        AccentColor="#F59E0B"
    }
)

$playing cards = @(
    [pscustomobject]@sections
    [pscustomobject]@pivots
    [pscustomobject]@course of
    [pscustomobject]@generated covers
)

$protection = @(
    [pscustomobject]@{ Identify="Engine"; X = 0.22; Y = 0.42; Element="OfficeIMO owns Open XML habits." }
    [pscustomobject]@{ Identify="PowerShell"; X = 0.48; Y = 0.34; Element="PSWriteOffice owns scripting ergonomics." }
    [pscustomobject]@{ Identify="Examples"; X = 0.68; Y = 0.58; Element="Showcase scripts show the floor." }
    [pscustomobject]@{ Identify="Web site"; X = 0.82; Y = 0.36; Element="Weblog posts flip artifacts into adoption." }
)

$capabilities = @(
    [pscustomobject]@metadata" 
    [pscustomobject]@deterministic paths" 
    [pscustomobject]@single-save move" 
)

$caseStudy = @(
    [pscustomobject]@{ Heading = 'Downside'; Physique = 'Primary examples disguise how a lot OfficeIMO can already produce.' }
    [pscustomobject]@{ Heading = 'Strategy'; Physique = 'Expose semantic PowerPoint plans and richer Workplace examples by means of PSWriteOffice.' }
    [pscustomobject]@{ Heading = 'End result'; Physique = 'A test-drive deck that is still editable and visually credible.' }
)

$metrics = @(
    [pscustomobject]@{ Worth="3"; Label="flagship merchandise" }
    [pscustomobject]@{ Worth="1"; Label="shared showcase plan" }
    [pscustomobject]@{ Worth="0"; Label="desktop Workplace dependency" }
)

$chartRows = @(
    [pscustomobject]@{ Product="Phrase"; Protection = 82; Polish = 72 }
    [pscustomobject]@{ Product="Excel"; Protection = 91; Polish = 83 }
    [pscustomobject]@{ Product="PowerPoint"; Protection = 76; Polish = 68 }
)

$tableRows = @(
    [pscustomobject]@{ Space="Designer bridge"; Standing="Added"; Subsequent="Add extra variant knobs" }
    [pscustomobject]@{ Space="Showcase deck"; Standing="Added"; Subsequent="Export screenshots" }
    [pscustomobject]@{ Space="Weblog submit"; Standing="Deliberate"; Subsequent="Write after visuals" }
)

$path=".PSWriteOffice-Service-Transient.pptx"

Then I map these objects right into a deck plan:

$plan = New-OfficePowerPointDeckPlan {
    Add-OfficePowerPointPlanSection `
        -Title 'PSWriteOffice Showcase' `
        -Subtitle 'Stunning, helpful Workplace artifacts from PowerShell' `
        -Seed 'showcase-cover'

    Add-OfficePowerPointPlanProcess `
        -Title 'From objects to publishable artifacts' `
        -Subtitle 'A repeatable path for examples and weblog posts' `
        -Steps $course of `
        -Seed 'delivery-process'

    Add-OfficePowerPointPlanCardGrid `
        -Title 'Product surfaces' `
        -Subtitle 'Every product ought to present an actual workflow, not solely primitives.' `
        -Playing cards $playing cards `
        -Seed 'product-cards'

    Add-OfficePowerPointPlanCoverage `
        -Title 'The place the work belongs' `
        -Subtitle 'Engine, wrapper, examples, and web site keep distinct.' `
        -Areas $protection `
        -Seed 'coverage-map'

    Add-OfficePowerPointPlanCapability `
        -Title 'High quality bar' `
        -Subtitle 'The showcase ought to be sensible sufficient to repeat and engaging sufficient to publish.' `
        -Sections $capabilities `
        -Seed 'quality-bar'

    Add-OfficePowerPointPlanCaseStudy `
        -Title 'PowerPoint designer bridge' `
        -Sections $caseStudy `
        -Metrics $metrics `
        -Seed 'designer-case-study'
}

The script now says what every slide is for. It now not has to elucidate the place each title and card ought to sit.

Writing slides two methods

The instance makes use of two writing modes:

  • Semantic slides by means of New-OfficePowerPointDeckPlan and Add-OfficePowerPointDesignerDeck.
  • Specific proof slides by means of PptSlide, PptChart, PptTable, and PptNotes.

I exploit designer composition for the narrative slides. For proof, I normally need the chart, desk, and speaker notes to be express so the result’s predictable.

Construct the deck as soon as

The showcase renders the deck plan, provides the proof slides, creates sections, and applies transitions in a single composition block. The presentation is saved as soon as as a substitute of being reopened for each step.

PptNew -Path $path  PptTransition -Transition Fade

PowerPoint chart slide using fictional Coverage and Polish values to demonstrate two editable series

I exploit the concise aliases constantly on this block; the longer command names stay accessible in assist. The output is a traditional presentation that may be edited, introduced, imported into one other deck, or reused as a template.

Use a presentation object for loop-driven decks

When a loop or situation decides which slides so as to add, I preserve the reside presentation object as a substitute of forcing the whole lot into one DSL block:

$presentation = New-OfficePowerPoint -Path '.Buyer-Briefing.pptx' -NoSave
$slide = Add-OfficePowerPointSlide -Presentation $presentation -LayoutType Textual content -PassThru
Set-OfficePowerPointSlideTitle -Slide $slide -Title 'Actions'
Add-OfficePowerPointTextBox -Slide $slide -Textual content 'Affirm the manufacturing date.' -X 90 -Y 170 -Width 700 -Top 60
$presentation | Save-OfficePowerPoint
$presentation | Shut-OfficePowerPoint

Each varieties use the identical engine and doc mannequin. Choose the one which makes the encircling script simpler to observe.

Studying and validating the deck

After saving, I learn the deck again. CI can then examine the slide rely, notes, sections, and proof slides as a substitute of solely checking {that a} .pptx file exists.

$presentation = Get-OfficePowerPoint -Path $path
$abstract = @(Get-OfficePowerPointSlideSummary -Presentation $presentation)
$presentation | Shut-OfficePowerPoint

$abstract |
    Choose-Object SlideIndex, Title, ShapeCount, TextBoxCount, ChartCount, TableCount, HasNotes

You may flip the identical read-back into assertions:

if (($abstract | The place-Object ChartCount -gt 0).Depend -lt 1) {
    throw 'Anticipated at the least one chart slide.'
}

if (($abstract | The place-Object HasNotes).Depend -lt 2) {
    throw 'Anticipated speaker notes for presenter handoff.'
}

These checks confirm the construction. I nonetheless open a consultant deck within the presentation software folks will use, as a result of an object rely can not verify fonts, structure, transitions, or presenter notes.

Efficiency and scale

Most PowerPoint era time is misplaced to repeated file opens and structure work the script didn’t must repeat.

  • Construct the deck plan in reminiscence, then render as soon as.
  • Use semantic sections for narrative content material as a substitute of manually putting each form.
  • Use express chart/desk slides solely the place the proof wants it.
  • Preserve photos and background belongings sized moderately earlier than embedding.
  • Add notes throughout era as a substitute of reopening slides later.
  • Validate slide summaries as a substitute of parsing each Open XML half in routine exams.

For a bigger briefing, I cut up the deck into cowl, story, proof, appendix, and handoff sections. The generated file is simpler to navigate, and the script has clear locations so as to add new materials.

The place I exploit the identical strategy

The identical mixture of designed narrative slides and express proof slides works for:

  • month-to-month service assessment decks with charts, proprietor actions, and speaker notes
  • buyer supply packs with milestones, capabilities, case research, and appendix tables
  • safety or compliance briefings with threat traits and remediation roadmaps
  • undertaking standing decks generated from problem trackers or planning techniques
  • reusable consulting templates the place knowledge modifications however the story construction stays steady

After the primary generated deck

Technology is just one a part of the PowerPoint workflow. The identical module can examine an current deck, copy permitted slides into one other presentation, replace textual content and notes, set up sections, and export an HTML assessment floor.

I nonetheless use coordinates when a slide genuinely wants actual placement. The distinction is that they’re now the exception. A lot of the script describes the story and knowledge, whereas the few proof slides preserve the exact structure they want.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments