Repository navigation
fix(hwpx): keep the captions of text boxes, shapes and group members - #2107
Open
RionHwang0 wants to merge 1 commit into
Open
RionHwang0 wants to merge 1 commit into
RionHwang0 wants to merge 1 commit into
Conversation
HwpxReader kept a caption only on hp:pic, so the caption of a text box or other shape (hp:rect, hp:ellipse, ...) and of every member of a group (hp:container) was dropped on HWPX → DOCX, HTML, EPUB and the other routes that read HWPX with Filee's own reader. Every drawing object's caption now follows its anchor paragraph, as a picture's already does.
KnifeLemon
approved these changes
Dec 6, 2026
KnifeLemon
left a comment
Owner
There was a problem hiding this comment.
Thanks, and the 198-file comparison is a good way to find this. Reading the caption of every drawing object, and of each member of a group in member order, matches what 한글 allows. AddCaptions walks containers the same way Group already does, so it adds no new depth exposure. The rename to AddObjectCaption reads better too. I'll merge main, add the CHANGELOG line under 2.6.0 Fixes after #2105 and #2106, and merge once CI is green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
HwpxReaderreads a caption only fromhp:pic. In 한글 any drawing object can carry one, and in a group each member keeps its own, so captions on text boxes and shapes were dropped on every route that reads HWPX with Filee's own reader. That covers HWPX → DOCX, HTML, EPUB and the other formatsDocumentReaderswrites, and HWPX translation.Affected:
hp:rect,hp:ellipse,hp:polygon, ...hp:container), including pictures inside a groupI found this by reading 198 public HWPX files (government press releases and a few synthetic files) with
HwpxReaderand comparing the text with thehp:ttext of each section. One press release (a cost table drawn as grouped boxes with captions such as "* 포괄수가 380만 원 + 치료재료 55만 원") lost 12 paragraphs, all of them shape captions. With this change that file reads complete. Its text is the only output that changes across the 198 files (it appears twice in the set).What changed:
DrawingObjectcalls a newAddCaptionsfor every drawing object. It adds the object's own caption and, for a group, each member's caption in member order.ParagraphBuilder.AddPictureCaptionis renamed toAddObjectCaption, and its field to_objectCaptions. The behaviour is the same: captions follow the complete anchor paragraph, as picture captions already do since fix(hwp): keep picture captions when converting to DOCX #2080.Type of change
How was it tested?
dotnet format --verify-no-changesdotnet test tests/Filee.Engines.Tests --filter "FullyQualifiedName~Hwpx|FullyQualifiedName~Hwp|FullyQualifiedName~Docx|FullyQualifiedName~NestingLimit": 275 passed, 27 skipped. Three tests fail the same way onmainhere: twoPandocMarkupTests(local pandoc version) andDocxNoteMarksTests.The_number_stays_inside_its_brackets_in_the_pdf.HwpxReaderTests.A_text_box_caption_follows_its_anchor_paragraph_also_in_a_group. It writes a document with a text box throughHwpxWriter, adds a caption to thehp:rect(once as is, once with the box wrapped in anhp:container), reads it back and checks that the caption is the paragraph right after the anchor paragraph, before the next paragraph. Both cases fail onmain.Checklist
src/Filee.App/Assets/i18n/*.jsonfiles (none added)THIRD-PARTY-NOTICES.md(none added)CHANGELOG lines (for your CHANGELOG PR):