Quick Start Guide
A minimal console app and an ASP.NET Core endpoint that produce a .pptx end to end.
0Namespaces used by the C# samples
using NetCorePpt; // PptxGen, Slide
using NetCorePpt.CoreInterfaces; // option objects: TextProps* / ShapeProps / ImageProps / TableProps / HAlign / VAlign ...
using NetCorePpt.CoreEnums; // ShapeType, ChartType, MediaType, ShadowType, BulletType, DashType, SCHEME_COLORS ...
using TableRow = System.Collections.Generic.List<NetCorePpt.CoreInterfaces.TableCell>;
Create a PowerPoint in 4 easy steps
NetCorePpt PowerPoint presentations are created by following 4 basic steps. See examples below by environment.
That's really all there is to it!
.NET Application
The same four steps, in C# — a console app, a service, whatever you are building.
Program.cs
NetCorePpt · C#
using NetCorePpt;
using NetCorePpt.CoreInterfaces;
// 1. Create a new Presentation
var pres = new PptxGen();
// 2. Add a Slide
var slide = pres.addSlide();
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media)
slide.addText("Hello World from NetCorePpt!", new TextPropsOptions
{
x = 1,
y = 1,
color = "363636",
});
// 4. Save the Presentation
await pres.exportToFile("Hello-World.pptx");Server-Side (ASP.NET Core)
Generation happens on the server, so an endpoint can hand the finished deck straight back to the caller — no browser download step.
Program.cs
NetCorePpt · C#
app.MapGet("/presentation", async () =>
{
var pptx = new PptxGen();
var slide = pptx.addSlide();
slide.addText("Hello World from NetCorePpt!", new TextPropsOptions
{
x = 1,
y = 1,
color = "363636",
});
var bytes = await pptx.exportToBytes();
return Results.File(bytes,
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"Hello-World.pptx");
});