ApiThemeFormatScheme
Class representing a theme format scheme.
Methods
Name |
Description |
ChangeBgFillStyles |
Sets the background fill styles to the current theme format scheme. |
ChangeEffectStyles |
Need to do
Sets the effect styles to the current theme format scheme. |
ChangeFillStyles |
Sets the fill styles to the current theme format scheme. |
ChangeLineStyles |
Sets the line styles to the current theme format scheme. |
Copy |
Creates a copy of the current theme format scheme. |
GetClassType |
Returns the type of the ApiThemeFormatScheme class. |
SetSchemeName |
Sets a name to the current theme format scheme. |
ToJSON |
Converts the ApiThemeFormatScheme object into the JSON object. |
Example
Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
var oMaster = oPresentation.GetMaster(0);
var oTheme = oSlide.GetTheme();
var oFormatScheme = oTheme.GetFormatScheme();
var oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 218, 185), 0);
var oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(238, 203, 173), 100000);
var oFill1 = Api.CreateRadialGradientFill([oGs1, oGs2]);
var oBgFill1 = Api.CreateRadialGradientFill([oGs1, oGs2]);
var oStroke1 = Api.CreateStroke(3 * 36000, oFill1);
oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(238, 149, 114), 0);
oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 114, 86), 100000);
var oBgFill2 = Api.CreateRadialGradientFill([oGs1, oGs2]);
var oFill2 = Api.CreateRadialGradientFill([oGs1, oGs2]);
var oStroke2 = Api.CreateStroke(3 * 36000, oFill2);
oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 127, 36), 0);
oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(238, 118, 33), 100000);
var oBgFill3 = Api.CreateRadialGradientFill([oGs1, oGs2]);
var oFill3 = Api.CreateRadialGradientFill([oGs1, oGs2]);
var oStroke3 = Api.CreateStroke(3 * 36000, oFill3);
oFormatScheme.ChangeFillStyles([oFill1, oFill2, oFill3]);
oFormatScheme.ChangeLineStyles([oStroke1, oStroke2, oFill3]);
oFormatScheme.ChangeBgFillStyles([oBgFill1, oBgFill2, oBgFill3]);
var oClrScheme = Api.CreateThemeColorScheme([Api.CreateRGBColor(160, 82, 45), Api.CreateRGBColor(205, 133, 63), Api.CreateRGBColor(222, 184, 135), Api.CreateRGBColor(245, 222, 179), Api.CreateRGBColor(240, 128, 128),
Api.CreateRGBColor(255, 69, 0), Api.CreateRGBColor(0, 0, 0), Api.CreateRGBColor(79, 79, 79), Api.CreateRGBColor(65, 105, 225), Api.CreateRGBColor(176, 196, 222), Api.CreateRGBColor(255, 255, 255), Api.CreateRGBColor(255, 222, 173)], "New color scheme");
var oFontScheme = Api.CreateThemeFontScheme("Arial", "Noto Sans Simplified Chinese", "Arabic", "Times New Roman", "Noto Serif Simplified Chinese", "Arabic", "New font scheme");
oTheme = Api.CreateTheme("Theme 1", oMaster, oClrScheme, oFormatScheme, oFontScheme);
oPresentation.ApplyTheme(oTheme);
oSlide.RemoveAllObjects();
var 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);
oShape.SetSize(300 * 36000, 130 * 36000);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
oParagraph.SetJc("left");
oParagraph.AddText("Create a shape by yourself to see the stroke style set to this presentation.");
oParagraph.AddLineBreak();
var sType = oFormatScheme.GetClassType();
oParagraph.AddText("Class type = " + sType);
oFormatScheme.SetSchemeName("New format scheme name");
oParagraph.AddLineBreak();
oParagraph.AddText("New name was set to the theme format scheme.");
oSlide.AddObject(oShape);
oSlide = Api.CreateSlide();
oPresentation.AddSlide(oSlide);
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", "ApiThemeFormatScheme.pptx");
builder.CloseFile();
Resulting document