RelativeVerticalPosition Enumeration |
Specifies to what the vertical position of a shape or text frame is relative.
Namespace:
Aspose.Words.Drawing
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic enum RelativeVerticalPosition
Public Enumeration RelativeVerticalPosition
public enum class RelativeVerticalPosition
type RelativeVerticalPosition
Members
| Member name | Value | Description |
---|
| Margin | 0 |
Specifies that the vertical positioning shall be relative to the page margins.
|
| Page | 1 |
The object is positioned relative to the top edge of the page.
|
| Paragraph | 2 |
The object is positioned relative to the top of the paragraph that contains the anchor.
|
| Line | 3 |
Undocumented.
|
| TopMargin | 4 |
Specifies that the vertical positioning shall be relative to the top margin of the current page.
|
| BottomMargin | 5 |
Specifies that the vertical positioning shall be relative to the bottom margin of the current page.
|
| InsideMargin | 6 |
Specifies that the vertical positioning shall be relative to the inside margin of the current page.
|
| OutsideMargin | 7 |
Specifies that the vertical positioning shall be relative to the outside margin of the current page.
|
| TableDefault | 0 |
Default value is Margin.
|
| TextFrameDefault | 2 |
Default value is Paragraph.
|
Remarks
ExamplesShows how to insert a floating image in the middle of a page.
DocumentBuilder builder = new DocumentBuilder();
Shape shape = builder.InsertImage(ImageDir + "Logo.jpg");
shape.WrapType = WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.HorizontalAlignment = HorizontalAlignment.Center;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
shape.VerticalAlignment = VerticalAlignment.Center;
builder.Document.Save(ArtifactsDir + "Image.CreateFloatingPageCenter.doc");
ExamplesInserts a watermark image into a document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
Image image = Image.FromFile(ImageDir + "Transparent background logo.png");
Shape shape = builder.InsertImage(image);
shape.WrapType = WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
shape.Left = (builder.PageSetup.PageWidth - shape.Width) / 2;
shape.Top = (builder.PageSetup.PageHeight - shape.Height) / 2;
doc.Save(ArtifactsDir + "DocumentBuilder.InsertWatermark.doc");
ExamplesInserts a watermark image into a document using DocumentBuilder (.NetStandard 2.0).
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
using (SKBitmap image = SKBitmap.Decode(ImageDir + "Transparent background logo.png"))
{
Shape shape = builder.InsertImage(image);
shape.WrapType = WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
shape.Left = (builder.PageSetup.PageWidth - shape.Width) / 2;
shape.Top = (builder.PageSetup.PageHeight - shape.Height) / 2;
}
doc.Save(ArtifactsDir + "DocumentBuilder.InsertWatermarkNetStandard2.doc");
See Also