İlkel Olmayan Şekildeki Veriler
İlkel Olmayan Şekildeki Verilere Erişme
Bazen yerleşik olmayan bir şekildeki verilere erişmeniz gerekir. Yerleşik şekillere ilkel şekiller denir; olmayanlara ilkel olmayan denir. Örneğin, farklı eğri bağlantılı çizgiler kullanarak kendi şekillerinizi tanımlayabilirsiniz.
İlkel Olmayan Bir Şekil
Aspose.Cells’de, ilkel olmayan şekillere şu tür atanır:AutoShapeType.NOT_PRIMITIVE . kullanarak türlerini kontrol edebilirsiniz.Shape.getAutoShapeType()yöntem.
kullanarak şekil verilerine erişin.Shape.getPaths()yöntem. İlkel olmayan şekli oluşturan tüm bağlı yolları döndürür. Bu yollar, sırayla her parçadaki noktaları içeren tüm bölümlerin bir listesini tutan ShapePath türündedir.
Aşağıdaki kod parçacığı, kullanımını gösterirShape.getPaths()ilkel olmayan şeklin yol bilgisine erişme yöntemi.
İlkel olmayan bir şekle örnek gösterir
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the resource directory | |
String dataDir = Utils.getSharedDataDir(NonPrimitiveShape.class) + "DrawingObjects/"; | |
Workbook workbook = new Workbook(dataDir + "NonPrimitiveShape.xlsx"); | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Accessing the user defined shape | |
Shape shape = worksheet.getShapes().get(0); | |
if (shape.getAutoShapeType() == AutoShapeType.NOT_PRIMITIVE) { | |
// Access Shape paths | |
ShapePathCollection shapePathCollection = shape.getPaths(); | |
// Access information of individual shape path | |
ShapePath shapePath = shapePathCollection.get(0); | |
// Access shape segment path list | |
ShapeSegmentPathCollection shapeSegmentPathCollection = shapePath.getPathSegementList(); | |
// Access individual segment path | |
ShapeSegmentPath shapeSegmentPath = shapeSegmentPathCollection.get(0); | |
ShapePathPointCollection segmentPoints = shapeSegmentPath.getPoints(); | |
for (Object obj : segmentPoints) { | |
ShapePathPoint pathPoint = (ShapePathPoint) obj; | |
System.out.println("X: " + pathPoint.getX() + ", Y: " + pathPoint.getY()); | |
} | |
} |