Skip to content

Fixes #195: Support floating (anchored) images - #197

Merged
drmacro merged 1 commit into
developfrom
feature/Issue-195-anchored-images
Oct 11, 2026
Merged

drmacro merged 1 commit into
developfrom
feature/Issue-195-anchored-images

Conversation

@ekimbernow

Copy link
Copy Markdown
Collaborator

Summary

  • New optional anchor child of image makes it a floating image. Attributes: h-relative (page, margin, column, character), h-align or h-offset, v-relative (page, margin, paragraph, line), v-align or v-offset, wrap (square, top-and-bottom, none), wrap-text, distance, behind-text. Added to the RNG with documentation.
  • The picture is created inline through POI, then its graphic is moved into a wp:anchor. Later floating images get a higher relativeHeight, so they are in front of earlier ones.
  • @fit-to-page-width is ignored (with a warning) for floating images. Tight wrapping is not supported. Unexpected attribute values warn and fall back to the defaults.
  • Tests, two fixtures (validated with jing) and a README release note added. Images without anchor are unchanged.
  • The distance documentation notes that the space is also reserved above the image and can push the previous paragraph's last line down. Use v-offset to avoid it.

Testing

  • mvn install passes.
  • Opened in Word: square wrap, top-and-bottom wrap, behind-text, an inline image for comparison, an image in a table cell, and header and footer images (right-aligned header image, centered behind-text watermark in the footer). All render as intended with no corruption warning.

Closes the second half of what was split from #167.

🤖 Generated with Claude Code

- Add an optional anchor child to image that makes it a floating image
  (wp:anchor) positioned relative to the page, margin, column, character,
  paragraph, or line, aligned or offset, with square, top-and-bottom, or
  no wrapping, a wrap distance, and a behind-text option. Tight wrapping
  is not supported.
- Create the picture inline through POI and then convert it to an anchor.
- Ignore @fit-to-page-width for floating images.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@drmacro drmacro self-assigned this Oct 11, 2026
@drmacro drmacro added the enhancement New feature or request label Oct 11, 2026
@drmacro
drmacro merged commit 77eb6fc into develop Oct 11, 2026
2 checks passed
@drmacro
drmacro deleted the feature/Issue-195-anchored-images branch October 11, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants