Skip to main content

Floating Objects

  • 3 minutes to read

The object in a document can be anchored in one of two ways: either inline, which means that the object is displayed within the text stream, or floating. Floating means that the object is strictly positioned, absolutely or relatively within the document, disregarding the text flow. To specify how text flows around the object, the text wrapping type is used.

DXRichEdit_ShadowKitten

To insert a floating picture into the document, use the InsertFloatingObjectPictureCommand command accessible at the Insert -> Illustrations command button group in in bar or Ribbon UI. Note that a different command is used to insert inline pictures.

To insert a floating text box, use the InsertFloatingObjectPictureCommand command accessible at the Insert -> Text command button group in bar or Ribbon UI.

A floating object is anchored to a document range, but can be positioned anywhere on the page that contains the anchor. When you insert a floating object in a certain document position, the anchor is located at the beginning of the first paragraph that contains the specified position.

End-users can drag, resize and rotate floating objects using selection handles. The Floating Object Layout Dialog enables end-users to change the position of an object, to specify how the text is wrapped around the object and rotate the object to a certain degree.

A number of commands is available on the Picture Tools Ribbon page or a command bar of the same name. The commands enable you to modify the fill and outline of floating objects and to specify how they are positioned in the document.

Ribbon Page Group

Commands

DXRichEdit_Ribbon_PictureTools_ShapeStyles

ChangeFloatingObjectFillColorCommand

ChangeFloatingObjectOutlineColorCommand

ChangeFloatingObjectOutlineWidthCommand

DXRichEdit_Ribbon_PictureTools_Arrange

Wrap Type:

SetFloatingObjectBehindTextWrapTypeCommand

SetFloatingObjectInFrontOfTextWrapTypeCommand

SetFloatingObjectSquareTextWrapTypeCommand

SetFloatingObjectThroughTextWrapTypeCommand

SetFloatingObjectTightTextWrapTypeCommand

SetFloatingObjectTopAndBottomTextWrapTypeCommand

Position:

SetFloatingObjectBottomCenterAlignmentCommand

SetFloatingObjectBottomLeftAlignmentCommand

SetFloatingObjectBottomRightAlignmentCommand

SetFloatingObjectMiddleCenterAlignmentCommand

SetFloatingObjectMiddleLeftAlignmentCommand

SetFloatingObjectMiddleRightAlignmentCommand

SetFloatingObjectTopCenterAlignmentCommand

SetFloatingObjectTopLeftAlignmentCommand

SetFloatingObjectTopRightAlignmentCommand

Bring Forward:

FloatingObjectBringForwardCommand

FloatingObjectBringInFrontOfTextCommand

FloatingObjectBringToFrontCommand

Send Backward:

FloatingObjectSendBackwardCommand

FloatingObjectSendBehindTextCommand

FloatingObjectSendToBackCommand

You can access and manipulate floating objects in code via the corresponding API. Classes relevant to floating objects are listed in the following table.

Object

Description

Exposed by

Shape

An object that can be placed above and below the text layer of the document, as well as within the document, with text surrounding it.

SubDocument.InsertPicture

SubDocument.InsertTextBox

ShapeCollection.Item

ShapeCollection

A collection of shapes in a document.

SubDocument.GetShapes

ShapeRelativeHorizontalPosition

Specifies to what the horizontal position of a shape is relative.

Shape.RelativeHorizontalPosition

ShapeRelativeVerticalPosition

Specifies to what the vertical position of a shape is relative.

Shape.RelativeVerticalPosition

ShapeHorizontalAlignment

Specifies the horizontal alignment of a shape.

Shape.HorizontalAlignment

ShapeVerticalAlignment

Specifies the type of vertical alignment to apply.

Shape.VerticalAlignment

ShapeLine

Contains formatting information for the shape's border.

Shape.Line

ShapeFill

Fill formatting for a shape.

Shape.Fill

OfficeImage

Gets a picture residing in the floating object.

Shape.Picture

SubDocument

Provides access to content of the text box.

TextBox.Document

See Also