形状から接続ポイントを取得
Contents
[
Hide
]
Aspose.Cellsでは、スプレッドシート内の形状を管理する豊富な機能を提供しています。形状を整列したり配置するためには、すべての接続ポイントが必要です。これを目的として、Shape.ConnectionPointsプロパティを使用して、形状の接続ポイントのリストを取得するために以下のコードを使用できます。
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-.NET | |
// Instantiate a new Workbook. | |
Workbook workbook = new Workbook(); | |
// Get the first worksheet in the book. | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Add a new textbox to the collection. | |
int textboxIndex = worksheet.TextBoxes.Add(2, 1, 160, 200); | |
// Access your text box which is also a shape object from shapes collection | |
Shape shape = workbook.Worksheets[0].Shapes[0]; | |
// Get all the connection points in this shape | |
float[][] ConnectionPoints = shape.GetConnectionPoints(); | |
// Display all the shape points | |
foreach (float[] pt in ConnectionPoints) | |
{ | |
System.Console.WriteLine(string.Format("X = {0}, Y = {1}", pt[0], pt[1])); | |
} |