استخراج النص من نوع العتاد شكل SmartArt

سيناريوهات الاستخدام الممكنة

يمكن Aspose.Cells استخراج نص من نوع Gear Smart Art Shape. للقيام بذلك ، يجب عليك أولاً تحويل Smart Art Shape إلى Group Shape باستخدام ملفShape.getResultOfSmartArt () طريقة. ثم يجب أن تحصل على مجموعة من جميع الأشكال الفردية التي تشكل شكل المجموعة باستخدامGroupShape.getGroupedShapes () طريقة. أخيرًا ، يمكنك تكرار كل الأشكال الفردية واحدًا تلو الآخر في حلقة واستخراج نصها باستخدام ملفالشكل والنصخاصية.

استخراج النص من نوع العتاد شكل SmartArt

يقوم نموذج التعليمات البرمجية التالي بتحميل ملفنموذج لملف Excelالذي يحتوي على نوع Gear Smart Art Shape. ثم يستخرج النص من أشكاله الفردية كما تمت مناقشته أعلاه. يرجى الاطلاع على إخراج وحدة التحكم من الكود الوارد أدناه كمرجع.

عينة من الرموز

// 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

إخراج وحدة التحكم

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