Aspose::Words::Drawing::ShapeBase::get_HorizontalAlignment method
ShapeBase::get_HorizontalAlignment method
Specifies how the shape is positioned horizontally.
Aspose::Words::Drawing::HorizontalAlignment Aspose::Words::Drawing::ShapeBase::get_HorizontalAlignment()
Remarks
The default value is None.
Has effect only for top level floating shapes.
Examples
Shows how to insert a floating image to the center of a page.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert a floating image that will appear behind the overlapping text and align it to the page's center.
SharedPtr<Shape> shape = builder->InsertImage(ImageDir + u"Logo.jpg");
shape->set_WrapType(WrapType::None);
shape->set_BehindText(true);
shape->set_RelativeHorizontalPosition(RelativeHorizontalPosition::Page);
shape->set_RelativeVerticalPosition(RelativeVerticalPosition::Page);
shape->set_HorizontalAlignment(HorizontalAlignment::Center);
shape->set_VerticalAlignment(VerticalAlignment::Center);
doc->Save(ArtifactsDir + u"Image.CreateFloatingPageCenter.docx");
See Also
- Enum HorizontalAlignment
- Class ShapeBase
- Namespace Aspose::Words::Drawing
- Library Aspose.Words for C++