Skip to content

Built-in engines W23: Word floating tables, UYAP UDF, RTF → TXT, Excel short date - #1693

Merged
KnifeLemon merged 10 commits into
builtin-enginesfrom
p4/w23
Nov 19, 2026
Merged

KnifeLemon merged 10 commits into
builtin-enginesfrom
p4/w23

Conversation

@KnifeLemon

Copy link
Copy Markdown
Owner

Built-in engines wave W23: Word floating tables and paragraph spacing, UYAP UDF documents, RTF → TXT line by line, and Excel's short date.

Word floating tables and spacing (#1194, #1152)

UYAP UDF documents → PDF, DOCX and the other document writers (#1338)

  • New UyapReader reads .udf (a ZIP with one content.xml, <template> root) into the document model: text runs with fonts, sizes, bold/italic/underline, colours, alignment, indents, tabs, tables, pictures, page size and margins. The renderer draws the PDF; every existing document writer follows.
  • Detection by content: ZIP + content.xml + <template> is UYAP. A .udf that isn't (a UDF disk image) is refused on document routes with error.udf_not_uyap (23 locales) and unpacks through the disk-image path.
  • Limits as for DOCX/HWPX: DocumentPackage/DocumentLimits, SafeXml (no DTD; only CheckCharacters off because UYAP writes control characters in CDATA), DocumentBudget, picture size and count caps, table nesting cap.
  • Reporter's file: 3 pages like UYAP's PDF, page breaks in the same places, Calibri 12 pt with UYAP's 15 pt lines.
  • Settings schema 103: existing libraries learn udf on their documents donut (custom claims stay put).

RTF → TXT line by line (#1204, #1416)

  • With the renderer on and no LibreOffice, RTF → TXT went RTF → PDF → text, which joined, folded and unindented lines. A direct built-in rtf → txt edge now writes one line per paragraph, \line as a newline, empty paragraphs as empty lines, spaces and tabs as written (PlainTextWriter.WriteLines). LibreOffice still takes it when installed.

Excel's short date, number format 14 (#1315)

  • Built-in format 14 follows the system's short date pattern, as Excel does (en-US m/d/yyyy, zh-CN yyyy/m/d); non-Gregorian or named patterns keep yyyy-mm-dd. [Bug]:excel转pdf的图片问题 #1315's date cells fit on zh-CN and en-US instead of ####.
  • Tests that check format 14 pin their culture.

Checks

  • New tests: ReportedCasesTests (+5), UyapTests (10), UyapSettingsTests (2), RtfToBuiltInTextTests (3), SheetPrintTests (+2), a renderer route test. Inputs built in code.
  • On the merged wave branch: Core 1771 passed; Engines (ReportedCases, Uyap, FileeRenderer, PageComposer, Docx, WordTable, Archive) 653 passed; (Rtf, Sheet, Office, SpreadsheetFormat, PlainText, HwpText…) 686 passed; 0 failed.
  • 30 reporters' files rendered before and after the floats change: HWP/HWPX unchanged; changed pages listed in the wave report.

Follow-ups went on the board.

🤖 Generated with Claude Code

KnifeLemon and others added 10 commits November 19, 2026 14:17
A Word table with w:tblpPr floats: Word places it from the top of the
paragraph after it (vertAnchor text) or against the margins or the page,
and the text after it goes around it. Filee laid it out in the flow, so
the report's figure captions (floating one-cell tables) took their own
room and the empty paragraphs after them went under them instead of
beside them.

The DOCX reader reads tblpPr into HTable.Float (an HAnchor: horzAnchor /
vertAnchor, tblpX / tblpY or tblpXSpec / tblpYSpec) and FloatDistance
(the From-text distances); only the layout engine uses them. The page
composer places such a table like a picture wrapped square: anchored to
the next paragraph (laid out ahead, so it keeps its list number), never
above the text before it, moved to the next column with that paragraph
when it would run past the bottom, and drawn with the page's floating
objects. A table taller than a column stays in the flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tables read from other formats get the 5 mm the HWPX writer leaves
under a table. Word puts the next paragraph right under its tables, so
a Word table (one with Word's column sizing) now gets none; every table
of the report took 14 pt more than in Word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A line holding an inline picture in a paragraph with "multiple" line
spacing was the picture's height times the multiple: a 330 pt figure on
1.1 lines left 33 pt of empty line, and the report's flowchart no longer
fitted on its page. Word spaces only the line's text: a picture on a
1.5 line with 12 pt text is its height and half the text's line, as
Word's own PDF of #356 has it. Equations are spaced like text, as
before; lines without pictures are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Word puts the larger of a paragraph's space after and the next one's
space before between them, not their sum, unless the settings turn its
HTML paragraph spacing off (w:doNotUseHTMLParagraphAutoSpacing). The
headings on page 3 of #1152 have 6 pt after and 12 pt before: Word's
PDF has 12 pt between them, Filee had 18. The reader now cuts the space
after by the next paragraph's space before, as it drops contextual
spacing; a paragraph that starts a page or column keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UYAP Document Editor files (.udf, Turkish courts and lawyers) are a ZIP
with one content.xml: the text in a CDATA block and paragraphs whose runs
point into it by offset. The new built-in UYAP reader turns them into the
document model, so the Filee renderer writes PDF and the writers DOCX,
ODT, HWPX, TXT and the rest. Fonts, sizes, bold/italic/underline, colours,
Swing alignment, indents, spacing, tab sets, tables, Base64 pictures, page
breaks, headers and footers and the page setup are read. Lines are as high
as Java makes them and text has no kerning, so the reporter's petition
breaks onto the same three pages as UYAP's own PDF.

".udf" is also a Universal Disk Format disc image. The content decides:
a ZIP whose content.xml has a <template> root is UYAP. A disc given to a
document route is refused with error.udf_not_uyap (all locales), which
points to Extract; the archive engine's new udf -> folder edge unpacks a
disc as an ISO and a UYAP file as its ZIP.

The package is read within DocumentLimits (part and total sizes counted
while unpacking, inflate ratio, no DTD, depth and element limits).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1204)

Without LibreOffice the built-in RTF → TXT went through the Filee renderer's
PDF and the PDF's text (or the HWPX writer), which wrapped long lines, joined
lines, dropped leading spaces, tabs and empty paragraphs and put an empty line
between all paragraphs. RTF → TXT now has a direct built-in edge in the HWP
text engine: RtfReader's document written by PlainTextWriter.WriteLines, as a
word processor saves plain text. LibreOffice keeps the conversion while it is
installed; RTF → DOCX, PDF and the other outputs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1315)

Excel shows format 14 in the short date of the PC's regional format
(11/8/2026 in the US, 2026/11/8 in China); Filee always used yyyy-mm-dd, one
character more, so the reporter's dates printed as ####. The XLSX and XLS
readers now take the current culture's short date pattern as the Excel code,
falling back to yyyy-mm-dd for other calendars and patterns with names or
eras. Other built-in formats are unchanged. Tests that check format 14 run
in en-US.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon KnifeLemon added the built-in engines Filee: built-in engines (Project 4), on the builtin-engines branch, not released yet label Nov 19, 2026
@KnifeLemon
KnifeLemon merged commit 1daabcb into builtin-engines Nov 19, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built-in engines Filee: built-in engines (Project 4), on the builtin-engines branch, not released yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant