Skip to content
Back to news
drive9/14/2026

Word's "Page Width" Fit, Finally Landing on the First Try

Documents' page-width zoom fit — Word's familiar behavior for a page wider than your window — now lands correctly the first time a document opens, not just after you touch the sidebar.

drivedocumentsbug-fix

Documents got a "Page width" auto-fit behavior this release, and then a same-day fix once it was checked against production: the fit landed correctly for the second render, but not the first.

The feature

When a document's page is wider than the editor's canvas — an A3-landscape page next to an open sidebar at a typical laptop width, for instance — the underlying Univer engine only centers the page while its render area is wider than the page itself. Below that threshold, it scrolls to the page's middle and clips both edges instead of shrinking to fit. A new attachDocFitToWidth function sets the zoom level that fits the page to the available width, both when the document mounts and whenever its container resizes, and gets out of the way the moment someone picks their own zoom level. It also applies through Univer's own operation path rather than the undoable command path, so fitting the page never shows up as a step in a document's undo history or triggers an autosave.

The bug, and the fix

Checked live immediately after that change shipped: a document opened at 80% zoom but positioned as though it were at 100%, with its right edge cut off the canvas — and it only drew correctly after the sidebar was toggled once. The cause was ordering: the zoom was being applied before Univer's own render unit existed, so the unit picked up the new scale for the page but never recalculated the page's position to match it. The fix runs the first fit on Univer's repaint-retry schedule instead of immediately, and follows every zoom change this module makes with a forced relayout, which re-triggers the resize calculation that repositions the page correctly.

Where it stands

Together, these two changes mean a document wider than the window now opens correctly fitted on the first paint — no sidebar toggle required to see it land.

Word's "Page Width" Fit, Finally Landing on the First Try — Piskes