Dişli Tipi SmartArt Şeklinden Metin Çıkarma

Olası Kullanım Senaryoları

Aspose.Cells, Gear Type Smart Art Shape’den metin çıkarabilir. Bunu yapmak için önce Smart Art Shape’i kullanarak Group Shape’e dönüştürmelisiniz.Shape.getResultOfSmartArt() yöntem. Ardından, Grup Şeklini oluşturan tüm Bireysel Şekillerin dizisini kullanarak almalısınız.GroupShape.getGroupedShapes() yöntem. Son olarak, tüm Bireysel Şekilleri bir döngüde birer birer yineleyebilir ve metinlerini kullanarak ayıklayabilirsiniz.şekil.metinEmlak.

Dişli Tipi SmartArt Şeklinden Metin Çıkarma

Aşağıdaki örnek kod,örnek excel dosyasıGear Type Smart Art Shape’i içerir. Ardından, yukarıda tartışıldığı gibi metni tek tek şekillerinden çıkarır. Lütfen referans için aşağıda verilen kodun konsol çıktısına bakın.

Basit kod

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Load sample Excel file containing gear type smart art shape.
Workbook wb = new Workbook(srcDir + "sampleExtractTextFromGearTypeSmartArtShape.xlsx");
// Access first worksheet.
Worksheet ws = wb.getWorksheets().get(0);
// Access first shape.
Shape sh = ws.getShapes().get(0);
// Get the result of gear type smart art shape in the form of group shape.
GroupShape gs = sh.getResultOfSmartArt();
// Get the list of individual shapes consisting of group shape.
Shape[] shps = gs.getGroupedShapes();
// Extract the text of gear type shapes and print them on console.
for (int i = 0; i < shps.length; i++)
{
Shape s = shps[i];
if (s.getType() == AutoShapeType.GEAR_9 || s.getType() == AutoShapeType.GEAR_6)
{
System.out.println("Gear Type Shape Text: " + s.getText());
}
}//for

Konsol Çıkışı

Gear Type Shape Text: Nice Gear Type Shape Text: Good Gear Type Shape Text: Excellent