Skip to content

feat(preview): add local Office document previews#154

Open
roxi3906 wants to merge 21 commits into
aipoch:mainfrom
roxi3906:docs/roxi/oss-office-preview-research
Open

feat(preview): add local Office document previews#154
roxi3906 wants to merge 21 commits into
aipoch:mainfrom
roxi3906:docs/roxi/oss-office-preview-research

Conversation

@roxi3906

Copy link
Copy Markdown
Contributor

Summary

Add fully local, read-only previews for Word, Excel, and PowerPoint files in the managed file workbench. The implementation uses dedicated open-source renderers for each Office format and integrates with the owner-scoped managed preview resource system.

Highlights

  • Preview .docx, .xls, .xlsx, and .pptx files directly inside the desktop app.
  • Keep Office contents local without cloud conversion, Microsoft Office, or editing capabilities.
  • Fall back safely for encrypted, malformed, legacy .doc/.ppt, ZIP64, or unsupported packages.
  • Preserve responsive navigation by cleaning up stale renders, workers, generated DOM, Blob URLs, and viewer instances.

Impact

  • Affects managed artifact and upload previews, file-format detection, the preview registry, renderer CSP, and Office preview lifecycle handling.
  • Reads Office files through owner-scoped capabilities and bounded 1 MiB range IPC, with a 10 MiB DOCX cap and a 50 MiB cap for spreadsheets and presentations.
  • Validates OOXML ZIP structure, actual decompressed sizes, relationships, and DOCX XML complexity before invoking third-party renderers.
  • Uses docx-preview@0.4.0, @file-viewer/renderer-spreadsheet@2.1.29, @aiden0z/pptx-renderer@1.2.4, and saxes@6.0.0.
  • Upgrades PDF.js to 5.4.624 and keeps the range-based PDF preview path compatible with its legacy browser build and bundled worker.

Test Results

  • npm test: 233 test files passed, 1 skipped; 2,173 tests passed, 43 skipped.
  • Focused Office/PDF/navigation/CSP validation: 12 test files and 134 tests passed.
  • npm run lint: passed with no warnings.
  • npm run typecheck: passed for main/preload and renderer projects.
  • npm audit --omit=optional: 0 vulnerabilities.
  • npm run build: production Electron/Vite build passed.
  • electron-builder --dir: macOS arm64 application directory generated successfully with ad-hoc signing.
  • Packaged app.asar contains the PDF and spreadsheet workers plus DOCX, spreadsheet, and PPTX renderer chunks.

Potential Issues

  • Browser layout and font substitution are not pixel-identical to Microsoft Office.
  • Legacy .doc and .ppt files remain unsupported and require a future conversion path.
  • DOCX rendering includes synchronous third-party DOM work; the lower file and expanded-size limits are the hard resource boundary for that path.
  • A valid Office file is assembled in renderer memory after bounded range transfer, up to the format-specific cap.
  • Animations, video, uncommon SmartArt, and exact presentation metrics may degrade in PPTX previews.

Related PRs

Authors

roxi3906 added 15 commits July 17, 2026 10:54
…e-preview-research

# Conflicts:
#	src/main/artifacts/repository.test.ts
#	src/main/artifacts/repository.ts
#	src/main/uploads/repository.test.ts
#	src/main/uploads/repository.ts
#	src/main/windows.ts
#	src/renderer/index.html
#	src/renderer/src/pages/workspace/preview-support.ts
#	src/renderer/src/pages/workspace/previews/pdf-bytes.ts
#	src/renderer/src/pages/workspace/previews/pdfjs.ts
#	src/renderer/src/pages/workspace/previews/renderers/PdfPreview.tsx
#	src/renderer/src/pages/workspace/previews/renderers/PdfThumbnail.tsx
#	src/shared/artifacts.ts
#	src/shared/uploads.ts
…preview-research

# Conflicts:
#	package-lock.json
#	package.json
Keep application-owned loading chrome consistent across spreadsheet parsing phases. Hide the vendor blocking loader before render while preserving compact background progress indicators, with regression coverage for status transitions and cleanup.
Add a primary, status-aware managed download button to unsupported preview states. Shorten the spreadsheet parsing title to describe only the current phase.
@github-actions github-actions Bot added the enhancement New feature or request label Jul 22, 2026
@roxi3906
roxi3906 marked this pull request as ready for review July 23, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant