[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Characters
      Paragraphs
      Inline Pictures
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Sections
      Styles
      Lists
      Floating Objects
      Text Boxes
      Comments
      Checkboxes
      Document Properties
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
    HTML Tag Support
   [Expand]Examples
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Floating Objects

This topic describes how the RichEditControl manages the floating objects and shapes - pictures and text boxes. Floating means that the object is strictly positioned, absolutely or relatively within the document, regardless of the text flow. An object anchor (seen in the picture below) specifies the paragraph with which an object is associated and indicates where a floating object is located in relation to the text.

Expanded Insert a Floating Object

To insert a floating object to the document, use the ShapeCollection.InsertPicture or ShapeCollection.InsertTextBox method. By default, the inserted shape is positioned at the beginning of the first paragraph on the page that contains the floating object's anchor.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

All document shapes are contained in the ShapeCollection collection. It can be retrieved using the ReadOnlyShapeCollection.Get method. Access the necessary collection item by its index or name using the array notation. To specify the name of the target shape, use the Shape.Name property.

To find whether the retrieved item is the floating picture or the text box, check its Shape.TextBox and Shape.Picture properties. If the current object is the text box, its Shape.Picture property value is null, and vice versa, if the object's Shape.TextBox property is null, the object is the floating picture.

Tip

To select a shape, assign the Shape.Range to the Document.Selection property.

Expanded Modify the Floating Object

  1. Position

    To specify the flow of the text around the shape, use the Shape.TextWrapping property. To define the floating object's position within the document, use one of the following properties.

  2. Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

    The following code snippet uses the Shape.ZOrder property to position an image behind the specified floating object and sets the Shape.TextWrapping property to set the image behind the text of the document.

  3. Rotate and Resize

    To rotate the shape, use the Shape.RotationAngle property. To resize the floating object, specify its Shape.Size property. To scale the target shape horizontally or vertically, set the Shape.ScaleX or Shape.ScaleY property.

  4. Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

    The following code rotates text boxes and resizes floating pictures.

  5. Change the Shape Outline

    You can specify the shape outline color and thickness. Retrieve the border line using the Shape.Line property and set its ShapeLine.Color and ShapeLine.Thickness properties. If the floating object's background is transparent, you can change the fill color. To do that, use the ShapeFill.Color property.

Expanded Delete the Floating Object

The ShapeCollection where all the document shapes are contained is read-only, i.e., the collection items cannot be deleted. To remove the floating object from the document, delete the range to which the target shape is anchored. Retrieve the range using the Shape.Range property and pass it to the SubDocument.Delete method.

Expanded See Also

Is this topic helpful?​​​​​​​