VBA Code :-
With ActiveDocument.Shapes
.AddShape(msoShapeIsoscelesTriangle, _
10, 10, 100, 100).Name = "shpOne"
.AddShape(msoShapeIsoscelesTriangle, _
150, 10, 100, 100).Name = "shpTwo"
.AddShape(msoShapeIsoscelesTriangle, _
300, 10, 100, 100).Name = "shpThree"
With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
.Fill.PresetTextured msoTextureBlueTissuePaper
.GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
End With
End With
C# Code :-
public void GroupShapeCollection()
{
int typevalue = (int)Microsoft.Office.Core.MsoAutoShapeType.msoShapeIsoscelesTriangle;
ThisApplication.ActiveDocument.Shapes.AddShape(typevalue, 10.0f, 10.0f, 10.0f, 10.0f, ref missing).Name = "ShapeOne";
typevalue = (int)Microsoft.Office.Core.MsoAutoShapeType.msoShapeIsoscelesTriangle;
ThisApplication.ActiveDocument.Shapes.AddShape(typevalue, 150.0f, 10.0f, 100.0f, 100.0f, ref missing).Name = "shpTwo";
ThisApplication.ActiveDocument.Shapes.AddShape(typevalue, 300.0f, 10.0f, 100.0f, 100.0f, ref missing).Name = "shpThree";
///string[] names = new string[3] {"Matt", "Joanne", "Robert"};
string[] names = new string[3] {"ShapeOne","shpTwo","shpThree"};
object rangobj = names;
ThisApplication.ActiveDocument.Shapes.Range(ref rangobj).Group().Fill.PresetTextured(Microsoft.Office.Core.MsoPresetTexture.msoTextureBlueTissuePaper);
object objvalue = 2;
ThisApplication.ActiveDocument.Shapes.Range(ref rangobj).Group().GroupItems.get_Item(ref objvalue).Fill.PresetTextured(Microsoft.Office.Core.MsoPresetTexture.msoTextureGreenMarble);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment