GetAllShapes
Returns a collection of shape objects from the document content.
Parameters:
This method doesn't have any parameters.
Returns:
- Type
-
Array.<ApiShape>
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape1 = Api.CreateShape("rect", 100 * 36000, 100 * 36000, oFill, oStroke);
oParagraph.AddDrawing(oShape1);
oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 255, 0));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape2 = Api.CreateShape("star10", 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(0, 0, 255);
aShapes[0].SetVerticalTextAlign("bottom");
builder.SaveFile("docx", "GetAllShapes.docx");
builder.CloseFile();
Resulting document