TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

ApiTheme

new ApiTheme()

Class representing a presentation theme.

Methods

Name Description
GetClassType

Returns the type of the ApiTheme class.

GetColorScheme

Returns the color scheme of the current theme.

GetFontScheme

Returns the font scheme of the current theme.

GetFormatScheme

Returns the format scheme of the current theme.

GetMaster

Returns the slide master of the current theme.

SetColorScheme

Sets the color scheme to the current presentation theme.

SetFontScheme

Sets the font scheme to the current presentation theme.

SetFormatScheme

Sets the format scheme to the current presentation theme.

Example

Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
var oMaster = oPresentation.GetMaster(0);
var oTheme = oMaster.GetTheme();
var sThemeType = oTheme.GetClassType();
var oFontScheme = oTheme.GetFontScheme();
var sFontSchemeType = oFontScheme.GetClassType();
var oFormatScheme = oTheme.GetFormatScheme();
var sFormatSchemeType = oFormatScheme.GetClassType();
oSlide.RemoveAllObjects();
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oShape.SetSize(300 * 36000, 130 * 36000);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
oParagraph.SetJc("left");
oParagraph.AddText("Class type = " + sThemeType);
oParagraph.AddLineBreak();
oParagraph.AddText("Class type = " + sFontSchemeType);
oParagraph.AddLineBreak();
oParagraph.AddText("Class type = " + sFormatSchemeType);
oSlide.AddObject(oShape);
oSlide = Api.CreateSlide();
oPresentation.AddSlide(oSlide);
var oClrScheme = oTheme.GetColorScheme();
oClrScheme.ChangeColor(0, Api.CreateRGBColor(255, 111, 61));
oClrScheme.ChangeColor(1, Api.CreateRGBColor(51, 51, 51));
oSlide.RemoveAllObjects();
var oChart = Api.CreateChart("bar3D", [
    [200, 240, 280],
    [250, 260, 280]
  ], ["Projected Revenue", "Estimated Costs"], [2014, 2015, 2016], 4051300, 2347595, 24);
oChart.SetVerAxisTitle("USD In Hundred Thousands", 10);
oChart.SetHorAxisTitle("Year", 11);
oChart.SetLegendPos("bottom");
oChart.SetShowDataLabels(false, false, true, false);
oChart.SetTitle("Financial Overview", 20);
oChart.SetSize(300 * 36000, 130 * 36000);
oChart.SetPosition(608400, 1267200);
oSlide.AddObject(oChart);
builder.SaveFile("pptx", "ApiTheme.pptx");
builder.CloseFile();

Resulting document