ApiThemeColorScheme

new ApiThemeColorScheme()

Class representing a theme color scheme.

Methods

Name Description
ChangeColor

Changes a color in the theme color scheme.

Copy

Creates a copy of the current theme color scheme.

GetClassType

Returns the type of the ApiThemeColorScheme class.

SetSchemeName

Sets a name to the current theme color scheme.

ToJSON

Converts the ApiThemeColorScheme object into the JSON object.

Example

Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oSlide1 = oPresentation.GetSlideByIndex(0);
oSlide1.RemoveAllObjects();
var oMaster = oPresentation.GetMaster(0);
var oTheme1 = oMaster.GetTheme();
var oClrScheme = oTheme1.GetColorScheme();
oClrScheme.ChangeColor(0, Api.CreateRGBColor(255, 111, 61));
oClrScheme.ChangeColor(1, Api.CreateRGBColor(51, 51, 51));
oClrScheme.SetSchemeName("New color scheme name");
var sType = oClrScheme.GetClassType();
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);
oSlide1.AddObject(oChart);
oSlide1.ApplyTheme(oTheme1);
var oSlide2 = Api.CreateSlide();
oSlide2.RemoveAllObjects();
oPresentation.AddSlide(oSlide2);
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 = " + sType);
oParagraph.AddLineBreak();
oParagraph.AddText("New name was set to the theme color scheme.");
oSlide2.AddObject(oShape);
builder.SaveFile("pptx", "ApiThemeColorScheme.pptx");
builder.CloseFile();

Resulting document