Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[DOCX Compatibility] Wrapped shape positioned relative to a paragraph is not kept below the top margin (Word 2013+ compatibility mode), shifting the page layout and hiding text boxes

Open
#413 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
xml
Domain
backend

Research direction

Start with the attached paragraph-relative-shape-repro.docx and compat15-tb-shape.docx, and compare them against compat14-tb-shape.docx, which differs only in compatibilityMode. Measure the top edge of the wrapTopAndBottom shape through the converter endpoint. Done when a shape whose nominal top is above the top margin is clamped to the margin in compatibility mode 15, matching Word's 72 pt, and compatibility mode 14 is unchanged.

Written by the indexing model from the issue text.

Description

Summary

In a DOCX saved in Word 2013+ compatibility mode (compatibilityMode = 15), a floating shape that:

  • is positioned vertically relative to its paragraph (<wp:positionV relativeFrom="paragraph">),
  • has a negative offset that would place it above the top page margin, and
  • wraps text (wrapTopAndBottom, wrapSquare, wrapTight or wrapThrough)

is placed at the top margin by Microsoft Word, but at its raw offset (limited only by the page edge) by Euro-Office.

The text that wraps around the shape then starts higher in Euro-Office. Every floating object positioned relative to a later paragraph moves up with it. Objects positioned relative to the same paragraph stay where they are. Floating text boxes therefore end up overlapping, and a box with a solid fill can completely hide another one.

Word only applies this limit in compatibility mode 15. With compatibilityMode = 14, Word and Euro-Office agree, so Euro-Office appears to use the pre-2013 behaviour in both modes.

Version

  • Euro-Office Document Server ghcr.io/euro-office/documentserver:v9.3.4-hotfix.1 (Docker). The original real-world document also rendered this way on v9.3.2-rc.1.
  • Compared against Word for Microsoft 365 MSO (Version 2609 Build 16.0.20430.20032) 64-bit, exporting to PDF.
  • Measurements come from the PDF produced by the Document Server converter endpoint and Word's "Save as PDF", read with pdfplumber. The browser editor shows the same layout.

Steps to reproduce

  1. Open the attached paragraph-relative-shape-repro.docx in Word and in Euro-Office.
  2. Compare the positions of the three boxes.

The file was generated from scratch (generator script attached). It contains only:

Object Wrap Vertical position z-order
Box A (shaded) wrapTopAndBottom −3 cm, relative to paragraph 1 lowest
Box B (white fill) wrapNone +3.42 cm, relative to paragraph 1 highest
Box C (white fill) wrapNone +0.28 cm, relative to paragraph 7 middle

Page: A4, top margin 2.54 cm (72 pt). Settings: compatibilityMode = 15.

Expected behaviour (Word)

Box A is placed at the top margin (72 pt), because its nominal position (72 − 85 = −13 pt) is above the margin. The text after it starts below the box, and Box B and Box C are both visible, one under the other.

Image

Actual behaviour (Euro-Office)

Box A is placed at the page edge (0 pt), 72 pt higher than in Word. The paragraphs after it move up by the same amount. Box C (anchored to paragraph 7) moves up with them and ends up exactly under Box B (anchored to paragraph 1, which didn't move). Box B is higher in the z-order and has a white fill, so Box C is completely hidden.

Image

Measured positions (top edge, pt):

Word Euro-Office
Box A 72.0 0.0
Box B 168.9 168.9
Box C 240.7 168.9 (hidden behind Box B)
Body text 285.5 216.8

Isolating the rule

compat15-tb-shape.docx and compat14-tb-shape.docx are identical apart from compatibilityMode. Each has one wrapTopAndBottom shape at −1.64 cm relative to its paragraph, so its nominal top is 25.5 pt, inside the page but above the 72 pt margin:

File Word Euro-Office
compat 15 72.0 (limited to top margin) 25.5
compat 14 25.5 25.5

With wrapNone, Word does not apply the limit in either mode, and both editors agree.

Real-world impact

We found this in an emergency-procedure document, a page built from stacked text boxes under a tightly wrapped header banner. In Euro-Office, one of the safety instructions was completely hidden behind the box above it. The text is still in the document, so the reader gets no sign that anything is missing.

Possibly related

  • ONLYOFFICE/DocumentServer#3369, "Objects move inconsistently when fall into the range of multiple line break" (confirmed upstream, internal ticket 76179). It's in the same area: floating objects positioned relative to empty paragraphs.

Attachments

compat14-tb-shape.docx
compat15-tb-shape.docx
paragraph-relative-shape-repro.docx
generator-scripts.zip

Dominant language
Shell
Stars
1.8k
Forks
107
Avg merge
2d 10h
Merged PRs (30d)
42

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Euro-Office/DocumentServer

All issues in Euro-Office/DocumentServer

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.