ShapeBaseHeight Property

Gets or sets the height of the containing block of the shape.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.4
public double Height { get; set; }

Property Value

Type: Double

For a top-level shape, the value is in points.

For shapes in a group, the value is in the coordinate space and units of the parent group.

The default value is 0.

Shows how to resize an image shape.
DocumentBuilder builder = new DocumentBuilder();

// By default, the image is inserted at 100% scale
Shape shape = builder.InsertImage(ImageDir + "Logo.jpg");

// It is easy to change the shape size. In this case, make it 50% relative to the current shape size
shape.Width = shape.Width * 0.5;
shape.Height = shape.Height * 0.5;

// However, we can also go back to the original image size and scale from there, say 110%
ImageSize imageSize = shape.ImageData.ImageSize;
shape.Width = imageSize.WidthPoints * 1.1;
shape.Height = imageSize.HeightPoints * 1.1;

builder.Document.Save(ArtifactsDir + "Image.ScaleImage.doc");
Shows how to insert a floating image and specify its position and size.
// This creates a builder and also an empty document inside the builder
DocumentBuilder builder = new DocumentBuilder();

// By default, the image is inline
Shape shape = builder.InsertImage(ImageDir + "Logo.jpg");

// Make the image float, put it behind text and center on the page
shape.WrapType = WrapType.None;

// Make position relative to the page
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;

// Set the shape's coordinates, from the top left corner of the page
shape.Left = 100;
shape.Top = 80;

// Set the shape's height
shape.Height = 125.0;

// The width will be scaled to the height and the dimensions of the real image
Assert.AreEqual(125.0, shape.Width);

// The Bottom and Right members contain the locations of the bottom and right edges of the image
Assert.AreEqual(shape.Top + shape.Height, shape.Bottom);
Assert.AreEqual(shape.Left + shape.Width, shape.Right);

builder.Document.Save(ArtifactsDir + "Image.CreateFloatingPositionSize.docx");
See Also