非原始の形のデータ

非原始の形のデータへのアクセス

時々、ビルトインでない形状からデータにアクセスする必要があります。ビルトインの形状は原始形状と呼ばれ、そうでないものは非原始形状と呼ばれます。例えば、異なる曲線接続線を使用して独自の形状を定義することができます。

非原始の形状

Aspose.Cells for Python via .NETでは、非Primitive Shapeはタイプ 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))