GetAllShapes

function GetAllShapes(): void

Description

Returns a collection of shape objects from the document content.

Returns

void

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape1 = Api.CreateShape("rect", 95 * 36000, 85 * 36000, oFill, oStroke);
oParagraph.AddDrawing(oShape1);
oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape2 = Api.CreateShape("ellipse", 90 * 36000, 80 * 36000, oFill, oStroke);
oParagraph = Api.CreateParagraph();
oParagraph.AddDrawing(oShape2);
var oDocContent = oShape1.GetDocContent();
oDocContent.AddElement(0, oParagraph);
var aShapes = oDocContent.GetAllShapes();
oDocContent = aShapes[0].GetDocContent();
var sClassType = aShapes[0].GetClassType();
oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("Class Type = " + sClassType);
oParagraph.SetColor(51, 51, 51);
aShapes[0].SetVerticalTextAlign("bottom");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).