البيانات في شكل غير بدائي
Contents
[
Hide
]
الوصول إلى البيانات ذات الشكل غير البدائي
في بعض الأحيان ، تحتاج إلى الوصول إلى البيانات من شكل غير مضمن. تسمى الأشكال المضمنة الأشكال البدائية ؛ تلك التي لا تسمى غير بدائية. على سبيل المثال ، يمكنك تحديد الأشكال الخاصة بك باستخدام خطوط مختلفة متصلة منحنى.
شكل غير بدائي
في Aspose.Cells ، يتم تخصيص النوع للأشكال غير البدائيةنوع تلقائي. ليس بدائي . يمكنك التحقق من نوعها باستخدام ملفالشكل. نوع تلقائيخاصية.
قم بالوصول إلى بيانات الشكل باستخدام ملفالشكلخاصية. تقوم بإرجاع جميع المسارات المتصلة التي تشكل الشكل غير البدائي. هذه المسارات من النوعShapePathيحتوي على قائمة بجميع الأجزاء التي تحتوي بدورها على النقاط في كل جزء.
يعرض مثالاً لشكل غير بدائي |
---|
![]() |
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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
Workbook workbook = new Workbook(dataDir + "NonPrimitiveShape.xlsx"); | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Accessing the user defined shape | |
Shape shape = worksheet.Shapes[0]; | |
if (shape.AutoShapeType == AutoShapeType.NotPrimitive) | |
{ | |
// Access shape's data | |
ShapePathCollection shapePathCollection = shape.Paths; | |
// Access information of indvidual path | |
foreach (ShapePath shapePath in shapePathCollection) | |
{ | |
// Access path segment list | |
ShapeSegmentPathCollection pathSegments = shapePath.PathSegementList; | |
// Access individual path segment | |
foreach (ShapeSegmentPath pathSegment in pathSegments) | |
{ | |
// Gets the points in path segment | |
ShapePathPointCollection segmentPoints = pathSegment.Points; | |
foreach (ShapePathPoint pathPoint in segmentPoints) | |
{ | |
Console.WriteLine("X: " + pathPoint.X + ", Y: " + pathPoint.Y); | |
} | |
} | |
} | |
} |