كيفية إضافة شكل Group إلى مستند Word

Contents
[ ]

في بعض الأحيان تحتاج إلى إضافة group shape إلى مستند Word. يتكون group shape هذا من أشكال متعددة.

في Microsoft Word، يمكنك إضافة group shape بسرعة باستخدام أمر/زر Group. يمكن نقل شكل فردي في مجموعة بشكل منفصل.

في Aspose.Words، من السهل جدًا إضافة group shape باستخدام فئة GroupShape. يتم إنشاء Shape بشكل منفصل باستخدام فئة Shape ثم تتم إضافته إلى كائن GroupShape باستخدام طريقة AppendChild.

يوضح مثال التعليمات البرمجية التالي كيفية إضافة group shape إلى مستند Word:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
Document doc = new Document();
doc.EnsureMinimum();
GroupShape gs = new GroupShape(doc);
Shape shape = new Shape(doc, Drawing.ShapeType.AccentBorderCallout1);
shape.Width = 100;
shape.Height = 100;
gs.AppendChild(shape);
Shape shape1 = new Shape(doc, Drawing.ShapeType.ActionButtonBeginning);
shape1.Left = 100;
shape1.Width = 100;
shape1.Height = 200;
gs.AppendChild(shape1);
gs.Width = 200;
gs.Height = 200;
gs.CoordSize = new System.Drawing.Size(200, 200);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertNode(gs);
dataDir = dataDir + "groupshape-doc_out.doc";
// Save the document to disk.
doc.Save(dataDir);