FelisShape 0.5.8-rc1

This is a prerelease version of FelisShape.
dotnet add package FelisShape --version 0.5.8-rc1
NuGet\Install-Package FelisShape -Version 0.5.8-rc1
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="FelisShape" Version="0.5.8-rc1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FelisShape --version 0.5.8-rc1
#r "nuget: FelisShape, 0.5.8-rc1"
#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 FelisShape as a Cake Addin
#addin nuget:?package=FelisShape&version=0.5.8-rc1&prerelease

// Install FelisShape as a Cake Tool
#tool nuget:?package=FelisShape&version=0.5.8-rc1&prerelease

FelisShape

FelisShape is a .NET library for manipulating the presentations which conform to the Office Open XML File Formats specification. It is a platform-independent library base on the Open XML SDK.

Installation

dotnet add package FelisShape

Namespace

The basic namespace is FelisOpenXml.FelisShape. Some class may be contained in sub-namespace such as FelisOpenXml.FelisShape.Draw and so on.

Basic Usage

Presentation

Load a presentation from a stream:

var pres = new FelisPresentaion(soureceStream);

Create a empty presentation taken an other one as the template:

var template = new FelisPresentaion(templateStream);
var target = FelisPresentation.From(template);

Save a presentation:

// pres is an instance of FelisPresentation
pres.Save(targetStream);	// save to a stream
pres.Save("filePath.pptx");	// save to a file

Slide

Enumerating the slides in a presentation

// pres is an instance of FelisPresentation
foreach (var slide in pres.Slides)
{
	// TODO: ...
}

Insert a duplicate of a slide into a presentation

pres.InsertSlide(sourceSlide, indexForInsertingAt);

Remove a slide in a presentation

slide.Remove();
// or
pres.RemoveSlide(slide);

Edit a customer data in a slide

slide.WorkWithCustomerData("nameOfTheData", (XmlDocument dataDoc) =>
{
	// TODO: ...
	return true; // Return true means there is some changings should be commited to the slide. Otherwise return false.
}, true);
// The last argument of WorkWithCustomerData means if a new customer data should be created when there is no existing one.
// The default value is false.

Remove a customer data in a slide

slide.RemoveCustomerData("nameOfTheData");

Sumbit any changings in the slide

slide.Submit();
// Notice: Without invoking this method, the changings in the slide may be lost after close the presentation.

Shapes

Enumerating the shapes in a slide

foreach (var shape in slide.Shapes)
{
	// TODO: ...
}

Get a shape by a given ID in a slide or in a shapes group

slideOrGroup.GetShapeById(id);

Get a shape with a special type a slide or in a shapes group

slideOrGroup.GetShapes<T>();
// The T can be one of follows:
//		FelisShape
//		FelisPicture 
//		FelisTable 
//		FelisChart
//		FelisConnectionShape
//		FelisOleObject
//		FelisShapeGroup

Manipulating the data of the shape

The id of the shape

Console.WriteLine(shape.Id);
shape.Id = newId;

The name of the shape

Console.WriteLine(shape.Name);
shape.Name = newName;

The rect of the shape

var rect = shape.Rect;
shape.Rect = new FelisShapeRect() { x = 0, y = 0, cx = 100, cy = 100 };

The rect of the shape, the coordinate is relative to the parent shape

var ret = shape.RelativeRect;
shape.RelativeRect = new FelisShapeRect() { x = 0, y = 0, cx = 100, cy = 100 };

The text in the shape

Console.WriteLine(shape.TextBody?.Text);
shape.TextBody.Text = "Hello world";

The fill of the shape

var fill = new FelisSolidFillValue();
fill.Color.Value = Color.FromArgb(255, 0, 0);
shape.Fill = fill;

See the API document for more information


Season Studio Copyright(2023)

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
0.5.8-rc1 124 2/23/2023
0.5.7 293 2/18/2023

Upgrade from 0.5.7 for:
- Add same extension method to the OpenXmlElement-base object to make the tasks of searching or locating the element easily.
- Add method for manipulating the eaternal workbook of the chart
- Using "AddChild" for inserting the children element first to make sure that the element is locating in the correct postion.
- Fix the bug that the deep searching of the shapes' tree is invalid