CFXYZ.PowerPointEditorLib 1.0.13

dotnet add package CFXYZ.PowerPointEditorLib --version 1.0.13
NuGet\Install-Package CFXYZ.PowerPointEditorLib -Version 1.0.13
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CFXYZ.PowerPointEditorLib" Version="1.0.13" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CFXYZ.PowerPointEditorLib --version 1.0.13
#r "nuget: CFXYZ.PowerPointEditorLib, 1.0.13"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CFXYZ.PowerPointEditorLib as a Cake Addin
#addin nuget:?package=CFXYZ.PowerPointEditorLib&version=1.0.13

// Install CFXYZ.PowerPointEditorLib as a Cake Tool
#tool nuget:?package=CFXYZ.PowerPointEditorLib&version=1.0.13

PowerPoint Editor

A library to used to provide basic editing capabilities of PowerPoint presentation. It is primarily going to be used to give non-coders this ability via .net Interactive Notebooks. However, it could easily be used .net apps as well

Nuget Instant APIs Documentation GitHub last commit

Examples

Setup

var presentation = new PowerPointPresentation(pathToThePptx);

Text replacement

presentation.ForAllSlides()
            .ReplaceText("{{TEAM_NAME}}")
            .With("FooBar Unitied");

presentation.ForSlide(3)
            .ReplaceText("{{TEAM_NAME}}")
            .With("FooBar Unitied");

As you can see from the above, you can either specify to work with one single slide by its position in the deck with ForSlide(3) or all slides with ForAllSlides().

Inside the powerpoint you are using as a template, we are looking for the text {{TEAM_NAME}} and will replace it with FooBar United.

Sometime the text can be found in different sections of the powerpoint xml. This is because the styling/formatting changes mid sentence/paragraph. In these circumstances, you can automatically remove all the formatting changes (leaving it as the initial section is) and then replace the text. To do this use IgnoringStylingWith instead of With.

presentation.ForAllSlides()
            .ReplaceText("{{TEAM_NAME}}")
            .IgnoringStylingWith("FooBar Unitied");

presentation.ForSlide(3)
            .ReplaceText("{{TEAM_NAME}}")
            .IgnoringStylingWith("FooBar Unitied");

Working with images

presentation.ForSlide(2)
            .FindPictureWithAltText("TeamLogo")
            .ReplaceImageWith("C:\MyTeamLogo.jpg");

presentation.ForAllSlides()
            .FindPictureWithAltText("TeamLogo")
            .ReplaceImageWith("C:\MyTeamLogo.jpg");

presentation.ForSlide(2)
            .FindPictureWithAltText("TeamLogo")
            .ReplaceAltTextWith($"FooBar United Team Logo");

Here we are looking in slide 2 for an image with the alternate text to TeamLogo. We then replace the image with a jpg from our local disk and change the alternate text to be FooBar United Team Logo.

presentation.ForSlide(2)
            .FindPictureWithAltText("TeamLogo")
            .ReplaceHyperlinkWith("http://www.newlink.com");

Here we are looking in slide 2 for an image with the alternate text to TeamLogo. We then replace an existing hyperlink (there should already be one) with a new url.

Working with bar charts

presentation.ForSlide(3)
            .FindBarChart(1)
            .FindSeriesByName("Category A")
            .ReplaceValuesWith(new List<string> { "0.15", "0.3", "0.2", "0.2" });

presentation.ForSlide(3)
            .FindBarChart(1)
            .FindSeriesByName("Category B")
            .ReplaceValuesWith(new List<string> { "0.2", "0.4", "0.3", "0.32" });

presentation.ForSlide(3)
            .FindBarChart(1)
            .FindSeriesByName("Category C")
            .ReplaceValuesWith(new List<string> { "0.4", "0.8", "0.5", "0.48" });

We are editing the first bar chart on slide 3. It has 3 series and 4 values per series. We are adjusting the values of the chart to the percentages we have passed in.

Working with pie charts

presentation.ForSlide(4)
            .FindPieChart(2)
            .FindSeries()
            .ReplaceValuesWith(new List<string> { "0.2", "0.25", "0.1", "0.45" });

We are editing the second pie chart on slide 4. It has 4 values and we are adjusting them to the values we have passed in.

Working with table contents

presentation.ForSlide(5)
            .FindTable(1)
            .FindRow(2)
            .FindCell(1)
            .ReplaceCellText("Default cell text", "New cell text");

We are editing the first table on slide 5. We are then editing the second row and first column to replace the text "Default cell text" with "New cell text".

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.13 402 7/25/2022
1.0.12 363 7/25/2022
1.0.11 361 7/25/2022
1.0.10 384 6/29/2022
1.0.9 379 6/16/2022
1.0.8 390 5/6/2022
1.0.6 389 4/28/2022
1.0.5 377 4/5/2022
1.0.4 389 4/5/2022
1.0.3 394 4/5/2022
1.0.0 511 4/5/2022