Skip to content

Embedded DOCX HTML preview should scale pages to fit iframe width #70

@kuishou68

Description

@kuishou68

Summary

OfficeCLI Word HTML preview currently only enables scalePages() when the preview is running as the top-level window. When the generated HTML is embedded in an iframe (for example inside Cove's preview panel), landscape pages render at natural width and cannot fully fit the panel.

Repro

  1. Generate HTML preview for a landscape-heavy .docx via officecli view <file.docx> html --json.
  2. Render the returned HTML inside an iframe with a fixed-width container.
  3. Observe that pages keep natural width because window.top !== window.self, so the built-in fit-to-width logic is skipped.

Expected

Embedded preview should keep the same fit-to-width behavior as the standalone HTML preview, with an explicit opt-out only when a host truly wants native page width.

Acceptance Criteria

  • OfficeCLI embedded HTML preview scales pages to fit host width by default
  • Standalone preview behavior remains unchanged
  • Host can still explicitly disable page scaling when needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions