Change Adjustment Values of the Shape

Change Adjustment Values

The below code sample shows how to change adjustment values of the shape.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create workbook object from source excel file
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Access first three shapes of the worksheet
Shape shape1 = worksheet.Shapes[0];
Shape shape2 = worksheet.Shapes[1];
Shape shape3 = worksheet.Shapes[2];
// Change the adjustment values of the shapes
shape1.Geometry.ShapeAdjustValues[0].Value = 0.5d;
shape2.Geometry.ShapeAdjustValues[0].Value = 0.8d;
shape3.Geometry.ShapeAdjustValues[0].Value = 0.5d;
// Save the workbook
workbook.Save(dataDir + "output_out.xlsx");

How to set or change the RoundedRectangularCallout tip point in excel

The following code example shows how to set or change a rounded rectangle callout tip point position in Excel.

string filePath =@"";
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
// Add a RoundedRectangularCallout to the worksheet
Shape polygonShape = sheet.Shapes.AddAutoShape(AutoShapeType.RoundedRectangularCallout, 0, 0, 0, 0, 0, 0);
polygonShape.Y = 200; //Shape Top properties
polygonShape.X = 500; //Shape Left properties
polygonShape.Width = 200; // Shape Width
polygonShape.Height = 100; // Shape Height
ShapeGuideCollection shapeGuides = polygonShape.Geometry.ShapeAdjustValues;
shapeGuides.Add("adj1", 1.02167d); //The distance between the tip point and the center point, with negative values on the left and positive values on the right. Its value is usually the ratio of the half-width.
shapeGuides.Add("adj2", -0.295d); //The distance between the tip point and the center point, negative for upwards and positive for downwards. Its value is usually a ratio of the half-height.
shapeGuides.Add("adj3", 0.16667d); //Usually the default value
// Save the workbook
workbook.Save(filePath + "res.xlsx", SaveFormat.Xlsx);
// Read a new workbook
workbook = new Workbook(filePath + "res.xlsx");
sheet = workbook.Worksheets[0];
// Get a RoundedRectangularCallout from the worksheet
polygonShape = sheet.Shapes[0];
shapeGuides = polygonShape.Geometry.ShapeAdjustValues;
shapeGuides[0].Value = 0.7d;
// Save the workbook
workbook.Save(filePath + "res-resave.xlsx", SaveFormat.Xlsx);