Skip to content

feat: add Word and Excel preview in review UI#22601

Open
NeoMei wants to merge 3 commits intoanomalyco:devfrom
NeoMei:feature/office-preview
Open

feat: add Word and Excel preview in review UI#22601
NeoMei wants to merge 3 commits intoanomalyco:devfrom
NeoMei:feature/office-preview

Conversation

@NeoMei
Copy link
Copy Markdown

@NeoMei NeoMei commented Apr 15, 2026

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds native preview support for Word (.docx) and Excel (.xlsx) files in the review UI and file tabs. Previously these files were treated as binary and showed a generic "Binary file" message. Now they render as HTML so users can view their contents naturally.

Backend changes:

  • Removed docx, xlsx, pptx from the binary file list in packages/opencode/src/file/index.ts.
  • Added office extension recognition.
  • Office files are now read and returned as base64-encoded text content.

UI changes:

  • Added "office" to MediaKind in packages/ui/src/pierre/media.ts.
  • Created OfficeViewer component (packages/ui/src/components/office-viewer.tsx):
    • Uses mammoth to convert .docx to semantic HTML.
    • Uses xlsx (SheetJS) to convert .xlsx sheets to HTML tables.
    • .pptx shows a "not supported yet" placeholder.
  • Added office-viewer.css with basic typography and table styling.

App changes:

  • Updated onError type in packages/app/src/pages/session/file-tabs.tsx to include "office" kind.

Fixes:

  • Fixed broken symlink custom-elements.d.ts in packages/app and packages/enterprise that caused typecheck failures on Windows.

How did you verify your code works?

  • Ran bun turbo typecheck — all 14 packages passed.
  • Ran bun run build in packages/desktop — Vite build completed successfully (2293 modules transformed).
  • Could not run live Tauri dev due to missing Rust (cargo) in the environment.

Screenshots / recordings

N/A — could not run the live desktop app in this environment.

Checklist

  • I have tested my changes locally (typecheck + build)
  • I have not included unrelated changes in this PR

@NeoMei NeoMei requested a review from adamdotdevin as a code owner April 15, 2026 10:10
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

- Recognize docx/xlsx/pptx as office media type instead of binary
- Return base64-encoded content for office files from the backend
- Add OfficeViewer component using mammoth (docx) and xlsx (xlsx)
- Add office-preview CSS with basic typography and table styling
- PPT preview is not supported yet and shows a placeholder message
- Fix broken symlink for custom-elements.d.ts in app package
@NeoMei NeoMei force-pushed the feature/office-preview branch from 23e4d27 to 7af8534 Compare April 15, 2026 10:17
@NeoMei
Copy link
Copy Markdown
Author

NeoMei commented Apr 15, 2026

The unit (windows) failure is a pre-existing network issue unrelated to this PR:

error: TarballFailedToDownload downloading tarball ghostty-web@github:anomalyco/ghostty-web#main error: ghostty-web@github:anomalyco/ghostty-web#main failed to resolve

All other checks pass, including e2e (windows) which validates the symlink fix. Could a maintainer please re-trigger the failed job when convenient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant