Files
genoffice/apps/docs/tests
konghaojie-k2 93b8938c45 fix docs per-section page margins and pct table widths (#177)
* fix docs canvas losing per-section left page margins

The editor pads .doc-page by the FIRST section's margins (--page-pad) and
only ever gave later sections their own wrap width, never their own x
offset. A document whose opening section is full-bleed (w:pgMar
w:left="0", typical for a cover page) therefore lost the 30mm left margin
on every following page: body blocks kept the correct width but were
glued to the paper edge, leaving a dead band on the right.

sectionWidthSpecs now emits a real dx (the block's section marginLeft
minus the canvas inset). It rides the existing visual-translate channel,
composes with column/vAlign offsets, and is neutralized while measuring,
so page slicing is untouched. Gap header/footer strips follow their own
section inset (--gap-ml on the gap box) instead of being pinned to the
first section's column; table gaps keep the canvas target.

Vertical margins were already per-page (the gap bands carry each
section's top/bottom), which is why only the horizontal offset leaked.

* fix docs pct-width tables spanning the whole paper

w:tblW type="pct" (and AutoFit to Window, which parses as 100%) is a share
of the section's TEXT COLUMN. Both rendered a bare width:100%, which
resolves against the canvas' padding box — and that box is padded by the
FIRST section's margins. A document opening with a full-bleed cover
section (w:pgMar w:left="0") therefore laid every later table across the
whole paper, hanging past the right edge as soon as the body sections'
own left inset was applied.

Both paths now resolve through the per-block --doc-content-w that
sectionWidthSpecs already delivers (unset → the old percentage, so
single-section documents are byte-identical). Protected tables get the
same treatment; nested tables keep their cell-relative % since they
inherit the outer table's --doc-content-w.
2026-09-02 20:06:25 +08:00
..
2026-08-24 23:20:31 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00
2026-08-02 19:52:16 +08:00