-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature][CPE] ApiMaster smokes (#1191)
* new tests * fix tests * fix codestyle * fix failed tests
- Loading branch information
Showing
21 changed files
with
562 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
|
||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
var nCountBefore = oMaster.GetLayoutsCount(); | ||
var oLayout = Api.CreateLayout(); | ||
oMaster.AddLayout(0, oLayout); | ||
var nCountAfter = oMaster.GetLayoutsCount(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Layouts before: ' + nCountBefore + ', after: ' + nCountAfter); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "AddLayout.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
var nCountBefore = oMaster.GetAllShapes().length; | ||
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); | ||
oMaster.AddObject(oShape); | ||
var nCountAfter = oMaster.GetAllShapes().length; | ||
|
||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
var oRun = Api.CreateRun(); | ||
oRun.AddText('before: ' + nCountBefore + ', after: ' + nCountAfter); | ||
oParagraph.AddElement(oRun); | ||
builder.SaveFile("pptx", "AddObject.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
var oMaster = oPresentation.GetMaster(0); | ||
var oRGBColor = Api.CreateRGBColor(255, 213, 191); | ||
var oGs1 = Api.CreateGradientStop(oRGBColor, 0); | ||
var oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 111, 61), 100000); | ||
var oFill = Api.CreateRadialGradientFill([oGs1, oGs2]); | ||
oMaster.SetBackground(oFill); | ||
oMaster.ClearBackground(); | ||
builder.SaveFile("pptx", "ClearBackground.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
|
||
var nCountBefore = oPresentation.GetMastersCount(); | ||
var oCopyMaster = oMaster.Copy(); | ||
oPresentation.AddMaster(1, oCopyMaster); | ||
var nCountAfter = oPresentation.GetMastersCount(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Masters before: ' + nCountBefore + ', after: ' + nCountAfter); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "Copy.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster1 = oPresentation.GetMaster(0); | ||
|
||
var oMaster2 = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster2); | ||
var nCountBefore = oPresentation.GetMastersCount(); | ||
oMaster2.Delete(); | ||
var nCountAfter = oPresentation.GetMastersCount(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Masters before: ' + nCountBefore + ', after: ' + nCountAfter); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "Delete.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
|
||
var nCountBefore = oPresentation.GetMastersCount(); | ||
oMaster.Duplicate(1); | ||
var nCountAfter = oPresentation.GetMastersCount(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Masters before: ' + nCountBefore + ', after: ' + nCountAfter); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "Duplicate.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
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", 13); | ||
oChart.SetSize(300 * 36000, 130 * 36000); | ||
oChart.SetPosition(608400, 1267200); | ||
oMaster.AddObject(oChart); | ||
var aCharts = oMaster.GetAllCharts(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Charts count: ' + aCharts.length + ', type: ' + aCharts[0].GetClassType()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetAllCharts.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
var oImage = Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", 60 * 36000, 35 * 36000); | ||
oMaster.AddObject(oImage); | ||
var oOleObject = Api.CreateOleObject("https://i.ytimg.com/vi_webp/SKGz4pmnpgY/sddefault.webp", 130 * 36000, 90 * 36000, "https://youtu.be/SKGz4pmnpgY", "asc.{38E022EA-AD92-45FC-B22B-49DF39746DB4}"); | ||
oOleObject.SetSize(200 * 36000, 130 * 36000); | ||
oOleObject.SetPosition(70 * 36000, 30 * 36000); | ||
oMaster.AddObject(oOleObject); | ||
var aDrawings = oMaster.GetAllDrawings(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Drawings count: ' + aDrawings.length); | ||
oParagraph.AddLineBreak(); | ||
var aDrawingsTypes = [] | ||
for (var i=0; i<aDrawings.length; i++){ | ||
aDrawingsTypes.push(aDrawings[i].GetClassType()); | ||
} | ||
oParagraph.AddText('Types: ' + aDrawingsTypes.join(', ')); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetAllDrawings.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
var oImage = Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", 60 * 36000, 35 * 36000); | ||
oMaster.AddObject(oImage); | ||
var aImages = oMaster.GetAllImages(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Images count: ' + aImages.length + ', type: ' + aImages[0].GetClassType()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetAllImages.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
var oOleObject = Api.CreateOleObject("https://i.ytimg.com/vi_webp/SKGz4pmnpgY/sddefault.webp", 130 * 36000, 90 * 36000, "https://youtu.be/SKGz4pmnpgY", "asc.{38E022EA-AD92-45FC-B22B-49DF39746DB4}"); | ||
oOleObject.SetSize(200 * 36000, 130 * 36000); | ||
oOleObject.SetPosition(70 * 36000, 30 * 36000); | ||
oMaster.AddObject(oOleObject); | ||
var aOleObjects = oMaster.GetAllOleObjects(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('OleObjects count: ' + aOleObjects.length + ', type: ' + aOleObjects[0].GetClassType()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetAllOleObjects.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
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); | ||
oMaster.AddObject(oShape); | ||
var aShapes = oMaster.GetAllShapes(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Shapes count: ' + aShapes.length + ', type: ' + aShapes[0].GetClassType()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetAllShapes.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
var sType = oMaster.GetClassType(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('GetClassType type: ' + sType); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetClassType.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('GetLayout layout type: ' + oMaster.GetLayout(0).GetClassType()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetLayout.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Layouts count: ' + oMaster.GetLayoutsCount()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetLayoutsCount.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
var oMaster = oPresentation.GetMaster(0); | ||
oSlide.RemoveAllObjects(); | ||
var oTheme = oMaster.GetTheme(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('GetTheme type: ' + oTheme.GetClassType()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "GetTheme.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
|
||
var nCountBefore = oMaster.GetLayoutsCount(); | ||
oMaster.RemoveLayout(3, 7); | ||
var nCountAfter = oMaster.GetLayoutsCount(); | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Layouts count before: ' + nCountBefore + ' after: ' + nCountAfter); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "RemoveLayout.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
// oPresentation.GetMaster(0).Delete(); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = Api.CreateMaster(); | ||
oPresentation.AddMaster(1, oMaster); | ||
|
||
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); | ||
oMaster.AddObject(oShape); | ||
var oImage = Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", 60 * 36000, 35 * 36000); | ||
oMaster.AddObject(oImage); | ||
|
||
oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('Drawings count: ' + oMaster.GetAllDrawings().length); | ||
oParagraph.AddLineBreak(); | ||
oMaster.RemoveObject(0, 1); | ||
oParagraph.AddText('Drawings count: ' + oMaster.GetAllDrawings().length); | ||
oParagraph.AddLineBreak(); | ||
oParagraph.AddText('Shapes: ' + oMaster.GetAllShapes().length + ', images: ' + oMaster.GetAllImages().length); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "RemoveObject.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
var oMaster = oPresentation.GetMaster(0); | ||
var oRGBColor = Api.CreateRGBColor(255, 213, 191); | ||
var oGs1 = Api.CreateGradientStop(oRGBColor, 0); | ||
var oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 111, 61), 100000); | ||
var oFill = Api.CreateRadialGradientFill([oGs1, oGs2]); | ||
oMaster.SetBackground(oFill); | ||
builder.SaveFile("pptx", "SetBackground.pptx"); | ||
builder.CloseFile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
builder.CreateFile("pptx"); | ||
var oPresentation = Api.GetPresentation(); | ||
var oSlide = oPresentation.GetSlideByIndex(0); | ||
oSlide.RemoveAllObjects(); | ||
var oMaster = oPresentation.GetMaster(0); | ||
var oTheme = oMaster.GetTheme(); | ||
var oFonts = oTheme.GetFontScheme(); | ||
oFonts.SetFonts("Times New Roman"); | ||
oTheme.SetFontScheme(oFonts); | ||
var result = oMaster.SetTheme(oTheme) | ||
|
||
var oShape = Api.CreateShape("rect", 100 * 36000, 50 * 36000); | ||
var oDocContent = oShape.GetDocContent(); | ||
var oParagraph = oDocContent.GetElement(0); | ||
oParagraph.AddText('SetTheme result: ' + result); | ||
oParagraph.AddLineBreak(); | ||
oParagraph.AddText('Fonts: ' + oTheme.GetFontScheme().ToJSON()); | ||
oParagraph.SetHighlight("black"); | ||
oSlide.AddObject(oShape); | ||
builder.SaveFile("pptx", "SetTheme.pptx"); | ||
builder.CloseFile(); |
Oops, something went wrong.