feat: opening a document says when a floating table was flattened

Word's w:tblpPr takes a table out of the flow — a cover page's layout table is
one — and the editor's block table cannot, so what follows it sits as far down
as the table is tall, a frame anchored there with it. Nothing in the document
said so; the import now warns, as it does for the other shapes it cannot hold.

Claude-Session: https://claude.ai/code/session_01Wzs2qG6Y5qm7mKmJHfu44G
This commit is contained in:
Steffen Becker committed 2026-09-11 09:10:29 +02:00
1 parent 98530afe3b
commit 85036b9559
4 files changed
+15

No files matched your search

+1
View File
@@ -1111,6 +1111,7 @@ const de: Messages = {
hfFlattened: 'Listen/Tabellen in Kopf- oder Fußzeilen wurden in Text umgewandelt',
textBoxFlattened: 'In Tabellenzellen oder anderen Textfeldern verschachtelte Textfelder wurden aufgelöst',
nestedTables: 'Verschachtelte Tabellen wurden in Absätze umgewandelt',
floatingTable: 'Eine frei positionierte Tabelle steht jetzt im Textfluss — was ihr folgt, kann tiefer sitzen als in Word',
comments: 'Kommentare wurden entfernt',
missingFonts: (fonts) => `Diese Schriftarten sind nicht installiert und wurden durch Ersatzschriften dargestellt: ${fonts}`,
},
+1
View File
@@ -1119,6 +1119,7 @@ const en = {
hfFlattened: 'Lists/tables in headers or footers were flattened to text',
textBoxFlattened: 'Text boxes nested in table cells or other text boxes were flattened',
nestedTables: 'Nested tables were flattened to paragraphs',
floatingTable: 'A floating table was placed in the text flow — what follows it may sit lower than in Word',
comments: 'Comments were removed',
missingFonts: (fonts: string) => `These fonts aren't installed and were shown with a substitute: ${fonts}`,
},
+7
View File
@@ -115,6 +115,13 @@ a producer writing EMU there (360000 = 1cm in EMU, 635cm read as twips) would ot
leave columns of no width. Under that width LibreOffice lays the declared gap out literally
— probed to 10.16cm on a 15.24cm text — so only the unholdable value is dropped.
**A floating table stays in the flow, with a warning.** Word's `w:tblpPr` takes a table
out of it — a cover page's layout table is one, and what follows starts where the table
does — which the editor's block table cannot do. So the blocks after it (and any frame
anchored to them) sit as far down as the table is tall; LibreOffice models the same table
as a text frame wrapping it, which is why its own layout of such a cover differs from
ours.
**A heading in a cell carries its own 0.** No style name reaches a cell, so the editor
draws the level's 12pt/6pt margins (`styles/headings.ts`) there — where a Word heading
whose style chain sets no spacing has none. The baked-in chain's silence is therefore
+6
View File
@@ -2746,6 +2746,12 @@ function buildTable(tbl: Element, ctx: Ctx): Node | null {
rows.push(row);
}
if (rows.length === 0) return null;
// A floating table (w:tblpPr) is out of Word's flow: what follows it starts where the
// table does. The editor has no such table, so it stays in the flow — and a frame
// anchored to the paragraph after it lands as far down as the table is tall.
if (fc(fc(tbl, 'tblPr'), 'tblpPr')) {
ctx.warnings.add('A floating table was placed in the text flow — what follows it may sit lower than in Word');
}
const attrs: Record<string, unknown> = { ...(tableMargins(tbl, useWeights, ctx, padBase[3]) ?? {}) };
if (pad) attrs.cellPadding = pad;
// w:tblHeader on the first row: Word repeats it at the top of every page the table