البيانات في شكل غير الذي يتميز ببساطة

الوصول إلى بيانات الشكل غير الذي يتميز ببساطة

في بعض الأحيان، تحتاج إلى الوصول إلى البيانات من شكل ليس مدمجًا. يطلق على الأشكال المدمجة ، الأشكال الأساسية ، ويطلق على الأشكال التي ليست كذلك ، الأشكال غير الأساسية. على سبيل المثال، يمكنك تحديد أشكالك الخاصة باستخدام خطوط متصلة مختلفة.

الشكل غير الأساسي

في Aspose.Cells لـ بايثون via .NET، يتم تعيين الأشكال غير الأساسية من النوع AutoShapeType.NOT_PRIMITIVE. يمكنك التحقق من نوعها باستخدام الخاصية Shape.auto_shape_type.

الوصول إلى بيانات الشكل باستخدام الخاصية Shape.paths. تُعيد جميع المسارات المتصلة التي تشكل الشكل غير الأساسي. هذه المسارات تكون من نوع ShapePath التي تحمل قائمة بجميع القطاعات التي بدورها تحتوي على النقاط في كل قطاع.

يظهر مثالًا على شكل غير أساسي
todo:image_alt_text
from aspose.cells import Workbook
from aspose.cells.drawing import AutoShapeType
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
workbook = Workbook(dataDir + "NonPrimitiveShape.xlsx")
worksheet = workbook.worksheets[0]
# Accessing the user defined shape
shape = worksheet.shapes[0]
if shape.auto_shape_type == AutoShapeType.NOT_PRIMITIVE:
# Access shape's data
shapePathCollection = shape.paths
# Access information of indvidual path
for shapePath in shapePathCollection:
# Access path segment list
pathSegments = shapePath.path_segement_list
# Access individual path segment
for pathSegment in pathSegments:
# Gets the points in path segment
segmentPoints = pathSegment.points
for pathPoint in segmentPoints:
print("X: " + str(pathPoint.x) + ", Y: " + str(pathPoint.y))