Get Started
Usage API
More information

Api

new Api()

Methods

Name Description
CreateBlipFill

Creates a blip fill to apply to the object using the selected image as the object background.

CreateBullet

Creates a bullet for a paragraph with the character or symbol specified with the sSymbol parameter.

CreateChart

Creates a chart with the parameters specified.

CreateGradientStop

Creates a gradient stop used for different types of gradients.

CreateGroup

Creates a group of drawings.

CreateImage

Creates an image with the parameters specified.

CreateLayout

Creates a new slide layout and adds it to the slide master if it is specified.

CreateLinearGradientFill

Creates a linear gradient fill to apply to the object using the selected linear gradient as the object background.

CreateMaster

Creates a new slide master.

CreateNoFill

Creates no fill and removes the fill from the element.

CreateNumbering

Creates a bullet for a paragraph with the numbering character or symbol specified with the sType parameter.

CreateParagraph

Creates a new paragraph.

CreatePatternFill

Creates a pattern fill to apply to the object using the selected pattern as the object background.

CreatePlaceholder

Creates a new placeholder.

CreatePresetColor

Creates a color selecting it from one of the available color presets.

CreateRadialGradientFill

Creates a radial gradient fill to apply to the object using the selected radial gradient as the object background.

CreateRGBColor

Creates an RGB color setting the appropriate values for the red, green and blue color components.

CreateRun

Creates a new smaller text block to be inserted to the current paragraph or table.

CreateSchemeColor

Creates a complex color scheme selecting from one of the available schemes.

CreateShape

Creates a shape with the parameters specified.

CreateSlide

Creates a new slide.

CreateSolidFill

Creates a solid fill to apply to the object using a selected solid color as the object background.

CreateStroke

Creates a stroke adding shadows to the element.

CreateTable

Creates a table.

CreateTheme

Creates a new presentation theme.

CreateThemeColorScheme

Creates a new theme color scheme.

CreateThemeFontScheme

Creates a new theme font scheme.

CreateThemeFormatScheme

Creates a new theme format scheme.

GetPresentation

Returns the main presentation.

ReplaceTextSmart

Replaces each paragraph (or text in cell) in the select with the corresponding text from an array of strings.

Save

Saves changes to the specified document.

Example

Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oSlide = Api.CreateSlide();
var oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 224, 204), 0);
var oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 164, 101), 100000);
var oFill = Api.CreateRadialGradientFill([oGs1, oGs2]);
oSlide.SetBackground(oFill);
oPresentation.AddSlide(oSlide);
oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is an example for base class methods.");
var oBullet = Api.CreateNumbering("ArabicParenR", 1);
oParagraph = Api.CreateParagraph();
oParagraph.SetBullet(oBullet);
oParagraph.AddText(" A new slide was created.");
oDocContent.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oParagraph.SetBullet(oBullet);
oParagraph.AddText(" The background of the new slide was set to pink.");
oDocContent.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oParagraph.SetBullet(oBullet);
oParagraph.AddText(" A blue shape was created with numbered paragraphs in it.");
oDocContent.Push(oParagraph);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "Api.pptx");
builder.CloseFile();

Resulting document