スマートアートをグループ形状に変換
Contents
[
Hide
]
可能な使用シナリオ
Smart Art ShapeをGroup Shapeに変換するには、Shape.getResultOfSmartArt()メソッドを使用します。これにより、スマートアートの形状をグループ形状として扱えるようになります。それにより、グループ形状の個々の部分または形状にアクセスできるようになります。
スマートアートをグループシェイプに変換する
以下のサンプルコードは、このスクリーンショットに示すようなスマートアート形状を含むsample Excel fileをロードします。その後、スマートアート形状をグループ形状に変換し、Shape.IsGroupプロパティを出力します。以下に示したサンプルコードのコンソール出力をご覧ください。
サンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load the sample smart art shape - Excel file | |
Workbook wb = new Workbook("sampleSmartArtShape_GetResultOfSmartArt.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first shape | |
Shape sh = ws.getShapes().get(0); | |
//Determine if shape is smart art | |
System.out.println("Is Smart Art Shape: " + sh.isSmartArt()); | |
//Determine if shape is group shape | |
System.out.println("Is Group Shape: " + sh.isGroup()); | |
//Convert smart art shape into group shape | |
System.out.println("Is Group Shape: " + sh.getResultOfSmartArt().isGroup()); |
コンソール出力
Is Smart Art Shape: true
Is Group Shape: false
Is Group Shape: true