Skip to content

HWP β†’ PDF: tables floating in a table cell stay where ν•œκΈ€ puts them (#49) - #91

Merged
KnifeLemon merged 1 commit into
mainfrom
fix/hwp-nested-table
Oct 16, 2026
Merged

KnifeLemon merged 1 commit into
mainfrom
fix/hwp-nested-table

Conversation

@KnifeLemon

@KnifeLemon KnifeLemon commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the latest report in #49: in a HWP file, a table inside a table cell (the μ—°λ²ˆ/행정정보λͺ… table in the user's form) was drawn about 55 mm (156 pt) lower than in ν•œκΈ€, on top of the paragraph below it. The same document saved as HWPX was fine.

Cause

  • ν•œκΈ€ stores the line of a paragraph that anchors a floating table (treatAsChar=0, vertRelTo=PARA, TOP_AND_BOTTOM) below the table.
  • rhwp export-hwpx marks its output with META-INF/rhwp-hwp5-origin. For files with that marker, rhwp follows the stored line positions.
  • Inside a table cell taller than its text, that means rhwp draws the table from the stored line instead of the top of its paragraph. The table ends up shifted down by its own height.

Fix

  • RhwpInput.Prepare gains AnchorTablesInCells. It applies only to HWPX converted from HWP, i.e. files with the marker.
  • It targets a paragraph inside hp:tc/hp:subList that holds just one such table, no text, and a single lineseg.
  • For that paragraph it moves the line's vertpos back to the paragraph start: vertpos βˆ’ vertOffset βˆ’ margins βˆ’ height. That is only done when the result stays between the previous line and the original one.
  • Nothing is drawn on that line, so only the table moves.
  • The marker itself is kept, because it changes other rhwp behaviour for HWP files.

Result on the user's file

  • The inner table is drawn where the HWPX version draws it.
  • The content below it sits 0.85 mm lower than in the HWPX rendering. The HWP rendering follows ν•œκΈ€'s stored positions, so it is actually closer to ν•œκΈ€.
  • The HWPX input renders exactly as before.

Test plan

  • New RhwpInputTests build a minimal HWPX in code. They cover the fix-up, paragraphs it must not touch, files without the marker, and a real rhwp render checked with PdfPig.
    • With the fix disabled, two of them fail.
  • Engines, Core and dotnet format pass.
  • Checked on the user's file in an isolated temp folder (not committed).

πŸ€– Generated with Claude Code

In an HWP, and in the HWPX rhwp's export-hwpx writes for it (META-INF/rhwp-hwp5-origin), rhwp follows the
stored line positions. ν•œκΈ€ stores the line of a paragraph that anchors a table (hp:pos vertRelTo="PARA", text
above and below) under the table; in a cell taller than its text rhwp drew the table from that line instead of
the paragraph's top, so the inner table of the consent form overlapped the "β€» μ΄μš©κΈ°κ΄€μ€ …" paragraph. The same
document saved as HWPX by ν•œκΈ€ (no marker) was laid out right.

RhwpInput moves that line up to the paragraph's top (the line minus the table's offset, outer margins and height)
when the HWPX comes from an HWP, the paragraph is in a table cell, holds nothing but that one table and the line
really is under it. Nothing is drawn on the line, and rhwp then puts the table where ν•œκΈ€ does. Hancom-saved
HWPX files and paragraphs with text are left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon
KnifeLemon merged commit 583dfaa into main Oct 16, 2026
5 checks passed
KnifeLemon added a commit to SeoJCalive/Filee that referenced this pull request Oct 16, 2026
main now has KnifeLemon#88 (donut groups, with review fixes) and KnifeLemon#80–KnifeLemon#91. The rotate
and flip migration becomes settings schema 17, after main's v11–v16; the
vector engine keeps main's summary and implements IImageTransformer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon KnifeLemon mentioned this pull request Oct 17, 2026
@KnifeLemon
KnifeLemon deleted the fix/hwp-nested-table branch October 19, 2026 12:55
@KnifeLemon KnifeLemon added the bug Something isn't working label Oct 20, 2026
@KnifeLemon KnifeLemon self-assigned this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant