Skip to content

feat: add office preview support for DOCX, PPTX, XLSX - #9041

Open
siddqamar wants to merge 7 commits into
stablyai:mainfrom
siddqamar:experiment/office-preview-ade-renderers
Open

siddqamar wants to merge 7 commits into
stablyai:mainfrom
siddqamar:experiment/office-preview-ade-renderers

Conversation

@siddqamar

@siddqamar siddqamar commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses #8301.

  • Adds Office previews for DOCX, XLSX, and PPTX files.
  • Renders visual-heavy PPTX slides through Microsoft PowerPoint on supported Windows hosts.
  • Preserves browser rendering and extracted-text fallbacks when native rendering is unavailable.
  • Supports documents loaded locally or over SSH.

Screenshots

image

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test

Verified with:

AI Review Report

Reviewed native rendering, fallback behavior, temporary-file cleanup, IPC typing, performance, and local/SSH document flow.

Cross-platform behavior was checked for Windows, macOS, and Linux. Native rendering is Windows-only; other platforms and Windows hosts without PowerPoint retain the browser and text fallbacks. No shortcuts or platform-specific labels were changed.

The review identified and fixed PowerPoint rejecting Windows 8.3 temporary paths.

Security Audit

The IPC accepts document bytes rather than arbitrary paths. PowerShell runs a static script with named arguments, uses an isolated temporary directory, has a bounded timeout, and cleans up after success or failure. No authentication data or secrets are accessed.

Notes

High-fidelity PPTX rendering requires Windows with Microsoft PowerPoint installed.

X: @siddqamar_ai

ELI5

You can preview Word, Excel, and PowerPoint files inside Orca without opening another app. It works for local and SSH files, with native Windows PowerPoint rendering for slides when available.

- render selectable DOCX and PPTX content in editor tabs
- add XLSX workbook and worksheet previews
- support Office binaries across local, SSH, relay, and runtime paths
- add parser and filesystem regression coverage
- Keep DOCX on Mammoth HTML preview

- Render PPTX through pptx-preview

- Parse XLSX workbooks with ExcelJS

- Ignore graphify-out artifacts
- Add loading state around pptx-preview

- Fall back to extracted slide text on timeout or render failure

- Keep PPTX renderer isolated from the Office viewer router
- Stop auto-falling back to text on slow decks

- Detect rendered slides with a DOM observer

- Keep extracted text as an explicit fallback
- Flatten slides through PowerPoint COM on supported Windows hosts.
- Preserve browser and extracted-text fallbacks across other runtimes.
- Cover native export, cleanup, IPC routing, and real COM rendering.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Office document preview support for DOCX, PPTX, and XLSX files across binary MIME handling, runtime file access, editor routing, and parsing. DOCX files render sanitized HTML, XLSX files render bounded spreadsheet tables, and PPTX files use browser previews with extracted-text fallback. Windows PowerPoint COM rendering is exposed through typed preload and IPC handlers with renderer-scoped cancellation. Tests cover parsing, routing, binary handling, native rendering, cancellation, and Windows integration. Localized viewer strings are added for supported locales.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Office preview support for DOCX, PPTX, and XLSX.
Description check ✅ Passed The description follows the template well, covering summary, screenshots, testing, AI review, security, and notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
src/renderer/src/components/editor/OfficePresentationView.tsx (1)

101-123: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Undocumented coupling to pptx-preview's internal DOM class names.

clearWrapperBackground/markRenderedIfSlideExists rely on .pptx-preview-wrapper and .pptx-preview-slide-wrapper, which aren't part of any documented public API of the pptx-preview package. This is likely the only way to detect render completion today, but a brief "why" comment would help future maintainers understand this is intentional and needs re-checking on library upgrades.

src/renderer/src/components/editor/OfficeDocumentViewer.tsx (1)

58-70: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Improve accessibility of sheet tabs.

Consider adding ARIA roles (role="tablist", role="tab") and aria-selected to the spreadsheet tabs so screen readers can properly announce the active sheet.

♿ Proposed ARIA improvements
-      <div className="flex gap-1 overflow-x-auto border-t border-border bg-muted p-1">
+      <div className="flex gap-1 overflow-x-auto border-t border-border bg-muted p-1" role="tablist">
         {sheets.map((candidate, index) => (
           <button
             type="button"
             key={candidate.name}
+            role="tab"
+            aria-selected={index === activeSheet}
             className={`rounded-sm px-3 py-1 text-xs ${index === activeSheet ? 'bg-background text-foreground' : 'text-muted-foreground hover:bg-accent'}`}
             onClick={() => setActiveSheet(index)}
           >

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 08f94a0e-73e5-44ef-975a-11fc1a9616a4

📥 Commits

Reviewing files that changed from the base of the PR and between ef23b67 and 0c4a213.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (32)
  • .gitignore
  • package.json
  • src/main/git/status.ts
  • src/main/ipc/filesystem.test.ts
  • src/main/ipc/filesystem.ts
  • src/main/ipc/powerpoint-preview.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/office/native-powerpoint-preview-script.ts
  • src/main/office/native-powerpoint-preview.integration.test.ts
  • src/main/office/native-powerpoint-preview.test.ts
  • src/main/office/native-powerpoint-preview.ts
  • src/main/runtime/orca-runtime-files.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/relay/fs-handler-utils.ts
  • src/relay/git-handler-utils.ts
  • src/renderer/src/components/editor/EditorContent.tsx
  • src/renderer/src/components/editor/OfficeDocumentViewer.tsx
  • src/renderer/src/components/editor/OfficePresentationView.tsx
  • src/renderer/src/components/editor/office-document-file.test.ts
  • src/renderer/src/components/editor/office-document-file.ts
  • src/renderer/src/components/editor/office-document-parse.test.ts
  • src/renderer/src/components/editor/office-document-parse.ts
  • src/renderer/src/components/editor/office-presentation-preview.test.ts
  • src/renderer/src/components/editor/office-presentation-preview.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/powerpoint-preview.ts
👮 Files not reviewed due to content moderation or server errors (1)
  • src/renderer/src/i18n/locales/ja.json

Comment thread src/main/git/status.ts Resolved
- keep Office diffs out of image rendering and cap spreadsheet materialization

- cancel abandoned PowerPoint exports and clean up timed-out COM processes

- add regression coverage for CodeRabbit findings and realistic COM timeouts
@siddqamar siddqamar changed the title Experiment/office preview ade renderers feat: add office preview support for DOCX, PPTX, XLSX Jul 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bac81b24-74ac-47ed-a45d-1a05504e9e17

📥 Commits

Reviewing files that changed from the base of the PR and between 0c4a213 and 6eed8b8.

📒 Files selected for processing (21)
  • src/main/git/status.test.ts
  • src/main/ipc/powerpoint-preview.test.ts
  • src/main/ipc/powerpoint-preview.ts
  • src/main/office/native-powerpoint-preview-script.ts
  • src/main/office/native-powerpoint-preview.integration.test.ts
  • src/main/office/native-powerpoint-preview.test.ts
  • src/main/office/native-powerpoint-preview.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/editor/OfficeDocumentViewer.tsx
  • src/renderer/src/components/editor/OfficePresentationView.tsx
  • src/renderer/src/components/editor/office-document-parse.test.ts
  • src/renderer/src/components/editor/office-document-parse.ts
  • src/renderer/src/components/editor/office-presentation-preview.test.ts
  • src/renderer/src/components/editor/office-presentation-preview.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/powerpoint-preview.ts
🚧 Files skipped from review as they are similar to previous changes (15)
  • src/shared/powerpoint-preview.ts
  • src/renderer/src/components/editor/office-presentation-preview.test.ts
  • src/preload/api-types.ts
  • src/main/ipc/powerpoint-preview.ts
  • src/preload/index.ts
  • src/renderer/src/components/editor/office-document-parse.test.ts
  • src/main/office/native-powerpoint-preview-script.ts
  • src/main/office/native-powerpoint-preview.test.ts
  • src/renderer/src/components/editor/OfficeDocumentViewer.tsx
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/editor/OfficePresentationView.tsx
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/es.json

Comment on lines +47 to +60
await execFileAsync(
'powershell.exe',
[
'-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Bypass',
'-File',
scriptPath,
'-OutputPath',
sourcePath
],
{ timeout: 60_000, windowsHide: true }
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Clean up PowerPoint when deck creation times out.

The timeout terminates only powershell.exe; forced termination can bypass the script’s finally and leave its out-of-process PowerPoint instance running. Track and terminate the COM process, as the production renderer now does.

#!/bin/bash
rg -n -C5 'execFileAsync|timeout|ProcessIdPath|terminatePowerPointProcess' \
  src/main/office/native-powerpoint-preview.integration.test.ts \
  src/main/office/native-powerpoint-preview.ts \
  src/main/office/native-powerpoint-preview-script.ts
🧰 Tools
🪛 ast-grep (0.44.1)

[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { execFile } from 'node:child_process'
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process-typescript)

Comment on lines +27 to +33
async function terminateRecordedPowerPointProcess(processIdPath: string): Promise<void> {
try {
const processIdText = await readFile(processIdPath, 'utf8')
if (!/^\d+$/.test(processIdText.trim())) {
return
}
process.kill(Number(processIdText.trim()), 'SIGKILL')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C6 'existingProcessIds|createdProcess|ProcessIdPath|process\.kill|terminatePowerPointProcess' \
  src/main/office/native-powerpoint-preview.ts \
  src/main/office/native-powerpoint-preview-script.ts \
  src/main/office/native-powerpoint-preview.test.ts

Repository: stablyai/orca

Length of output: 11178


🏁 Script executed:

#!/bin/bash
sed -n '1,220p' src/main/office/native-powerpoint-preview.ts
printf '\n--- SCRIPT ---\n'
sed -n '1,220p' src/main/office/native-powerpoint-preview-script.ts
printf '\n--- TESTS ---\n'
sed -n '1,180p' src/main/office/native-powerpoint-preview.test.ts

Repository: stablyai/orca

Length of output: 11896


Avoid killing a possibly unrelated PowerPoint process. The PID is inferred from a POWERPNT process-list diff, so a concurrent preview or a user starting PowerPoint in the same window can be picked up here and then SIGKILL-ed. Bind cleanup to the COM instance you created, or re-validate ownership before terminating it.

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { execFile } from 'node:child_process'
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process-typescript)

@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@batprem

batprem commented Oct 1, 2026

Copy link
Copy Markdown

I'm waiting for this feature!

This branch has not been deployed

No deployments
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.

4 participants