DOCX

Text Boxes

Floating text boxes with VML positioning and styling

Text boxes are floating containers rendered via VML (v:shape). Add one as a section child using the textbox key — it accepts shape positioning (style), paragraph-level properties (border, shading), and children (the body content).

Basic Text Box

{
  "sections": [
    {
      "children": [
        { "paragraph": { "children": ["Body paragraph beside the text box."] } },
        {
          "textbox": {
            "style": {
              "width": "2in",
              "height": "1in",
              "position": "absolute",
              "marginLeft": "1in",
              "marginTop": "0.5in",
              "wrapStyle": "square"
            },
            "children": [{ "paragraph": { "children": ["Text inside the floating box."] } }]
          }
        }
      ]
    }
  ]
}

Textbox Options

A textbox is a section child combining paragraph-level properties with shape geometry:

OptionTypeDescription
styleVmlShapeStyleShape positioning, size, wrapping, and rotation (see below)
childrenSectionChild[]Body content — paragraphs, tables, etc. (anything a section accepts)
paragraph propertiesvariousBorder, shading, and other ParagraphOptions (except style/children)

VmlShapeStyle

Controls the floating shape's layout. Lengths accept a number (points), a UniversalMeasure string ("2in", "5cm"), a percentage, or "auto".

PropertyTypeDescription
widthLengthUnitContaining-block width (required)
heightLengthUnitContaining-block height
left, topLengthUnitBlock position
marginLeft/Right/Top/BottomLengthUnitMargins relative to the shape anchor
position"static" | "absolute" | "relative"Positioning scheme
positionHorizontal"absolute" | "left" | "center" | "right" | "inside" | "outside"Horizontal anchor
positionHorizontalRelative"margin" | "page" | "text" | "char"Horizontal anchor reference
positionVertical"absolute" | "left" | "center" | "right" | "inside" | "outside"Vertical anchor
positionVerticalRelative"margin" | "page" | "text" | "char"Vertical anchor reference
wrapStyle"square" | "none"Text wrapping mode
wrapDistanceTop/Bottom/Left/RightnumberDistance (pt) from shape to wrapping text
rotationnumberRotation in degrees
flip"x" | "y" | "xy" | "yx"Orientation flip
visibility"hidden" | "inherit"Display state
zIndex"auto" | numberOverlap order

Content

children accepts the same section children as a document body — paragraphs, tables, even other text boxes — so a text box can hold richly formatted content:

{
  "textbox": {
    "style": {
      "width": "3in",
      "height": "2in"
    },
    "children": [
      {
        "paragraph": {
          "children": [
            {
              "text": "Title",
              "bold": true,
              "size": 28
            }
          ]
        }
      },
      {
        "paragraph": {
          "children": ["Supporting paragraph inside the box."]
        }
      }
    ]
  }
}
Copyright © 2026