Adding a Slide
addSlide(), the standard layouts, and the background of a slide.
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>;
Syntax
Create a new slide in the presentation:
PptxGenJS · javascript
let slide = pptx.addSlide();NetCorePpt · C#
var slide = pptx.addSlide();Returns
The
addSlide() method returns a reference to the created Slide object, so method calls can be chained.PptxGenJS · javascript
let slide1 = pptx.addSlide();
slide1
.addImage({ path: "img1.png", x: 1, y: 2 })
.addImage({ path: "img2.jpg", x: 5, y: 3 });NetCorePpt · C#
var slide1 = pptx.addSlide();
// `addImage` returns the slide again, so the JS chain maps 1:1 onto C#.
slide1
.addImage(new ImageProps { path = "img1.png", x = 1, y = 2 })
.addImage(new ImageProps { path = "img2.jpg", x = 5, y = 3 });You can also create multiple slides:
PptxGenJS · javascript
let slide1 = pptx.addSlide();
slide1.addText("Slide One", { x: 1, y: 1 });
let slide2 = pptx.addSlide();
slide2.addText("Slide Two", { x: 1, y: 1 });NetCorePpt · C#
var slide1 = pptx.addSlide();
slide1.addText("Slide One", new TextPropsOptions { x = 1, y = 1 });
var slide2 = pptx.addSlide();
slide2.addText("Slide Two", new TextPropsOptions { x = 1, y = 1 });Slide Methods
See Slide Methods for features such as Background and Slide Numbers.
Slide Masters
Want to use a layout with predefined logos, margins, or styles? See Slide Masters to learn how to create and apply slide masters.