シェイプの調整値の変更
Contents
[
Hide
]
Aspose.Cellsは、形状の調整ポイントを変更するために Shape.getGeometry().getShapeAdjustValues() プロパティを提供しています。Microsoft ExcelのUIでは、調整は黄色のダイヤモンドノードとして表示されます。たとえば:
- 角丸四角形は、円弧を変更するための調整があります
- 三角形は、ポイントの位置を変更するための調整があります
- 台形には、上部の幅を変更する調整があります
- 矢印には、頭部と末尾の形状を変更するための2つの調整があります
この記事では、異なる形状の調整値を変更する Shape.getGeometry().getShapeAdjustValues() プロパティの使用方法について説明します。
図形の調整値を変更
次のサンプルコードでは、ソースのExcelファイルの最初のワークシートの最初の3つの図形にアクセスし、その後、図形の調整値を変更します。以下のスクリーンショットは、調整値を変更する前の図形の外観と、調整値を変更した後の図形の外観を示しています。
調整値を変更する前の図形描画
調整値を変更した後の図形描画
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 | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ChangeAdjustmentValuesOfShape.class); | |
// Create workbook object from source excel file | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Access first three shapes of the worksheet | |
Shape shape1 = worksheet.getShapes().get(0); | |
Shape shape2 = worksheet.getShapes().get(1); | |
Shape shape3 = worksheet.getShapes().get(2); | |
// Change the adjustment values of the shapes | |
shape1.getGeometry().getShapeAdjustValues().get(0).setValue(0.5d); | |
shape2.getGeometry().getShapeAdjustValues().get(0).setValue(0.8d); | |
shape3.getGeometry().getShapeAdjustValues().get(0).setValue(0.5d); | |
// Save the workbook | |
workbook.save(dataDir + "output.xlsx"); |