MashukeAlam/doc-preview

Lightweight, elegant read-only document previewer for Windows (Office, CSV, Markdown)

C#

0

1 commits

updated Sep 24, 2026

See the code

See what people are saying

SourceMessageScoreDate

Previewing office files (r/SideProject)

Not everyone has MS Office, LibreOffice, WPS office installed and not everyone wants to open a full fledged heavy office suite just to preview the file (be it PPT, DOC, XLX, PDF, MD, CSV)... So here is a very lightweight app (sub 10MB) to just preview the file. Send feedbacks and it's open source -…

1

Sep 24, 2026

README

DocPreview — Lightweight Office & Document Previewer for Windows

DocPreview is an ultra-lightweight, elegant, read-only document previewer for Windows 10 & 11 built with C# (.NET 10) and WPF Fluent Design (Wpf.Ui).

It is designed strictly for instant previewing without the weight, memory consumption, or complexity of full office suites or Chromium/Electron apps.


✨ Key Features

  • ⚡ Ultra-Lightweight & Instant Startup:
    • ~8.6 MB published executable.
    • ~35–50 MB RAM footprint (reuses Windows Edge WebView2 runtime).
    • Sub-100ms document parse and rendering times.
  • 🎨 Modern Windows 11 Fluent UI:
    • Authentic Mica translucent window backdrop.
    • System-synced Dark and Light modes.
    • Frameless title bar with system snap layouts and quick action buttons.
  • 🧠 Smart Dual-Engine Architecture:
    • Engine A (Windows COM IPreviewHandler): Queries the Windows Registry for Microsoft Office preview handlers. If Office is installed, it leverages native COM with 100% fidelity and virtually zero memory overhead.
    • Engine B (High-Fidelity Standalone Engine): If Office is not installed on the system, the app seamlessly falls back to embedded, lightweight standalone parsers running 100% offline.
  • 🖱️ Frictionless UX & Shell Integration:
    • Windows Explorer Right-Click Menu: Right-click any document in Windows Explorer and select "Preview with DocPreview".
    • Drag & Drop: Drop any file directly onto the window.
    • CLI & Shell Integration: Pass file path via arguments (DocViewer.exe "path\to\doc.xlsx").
    • Interactive Controls: Zoom in/out, sheet tabs for Excel, slide carousel for PowerPoint, live filter search for CSV, and "Open with App" shortcut.

📁 Supported File Formats

FormatExtensionRendering PipelineFeatures
Word.docx, .docdocx-preview / COMFull pagination, headers, footers, tables, and images.
Excel.xlsx, .xlsExcelDataReader / COMMulti-sheet interactive tabs, cell formatting, and live search.
PowerPoint.pptx, .pptSlide Deck Engine / COMSlide thumbnails, 16:9 canvas viewer, and arrow key navigation.
Data.csv, .tsvCsvHelper Streaming TableSticky headers, row numbers, sortable columns, and instant filter.
Markdown.md, .markdownMarkdig + GitHub StylingCommonMark/GFM, code blocks, tables, task lists, dark/light themes.

⌨️ Keyboard Shortcuts

ShortcutAction
Ctrl + OOpen file dialog
Ctrl + + / Ctrl + -Zoom In / Zoom Out
Ctrl + 0Reset Zoom to 100%
Ctrl + EOpen current file in default system application
F5Reload preview
Left / Right ArrowPrevious / Next slide (when viewing PowerPoint)

🖱️ Windows Explorer Right-Click Integration

You can preview documents directly by right-clicking on them in Windows File Explorer:

  1. Option A: One-Click Inside the App

    • Click the Add-Ins / Context Menu button (right side of toolbar) in the app to toggle it on or off.
  2. Option B: Run the Included PowerShell Script

    • To enable: powershell -ExecutionPolicy Bypass -File .\register_context_menu.ps1
    • To remove: powershell -ExecutionPolicy Bypass -File .\unregister_context_menu.ps1
  3. Option C: Command-Line Flags

    .\publish\DocViewer.exe --register
    .\publish\DocViewer.exe --unregister
    

🚀 Running & Building

1. Run Development Build

dotnet run

2. Preview a Specific File via Command Line

dotnet run -- "test_samples\budget.xlsx"

3. Run Automated Self-Tests

Verifies document parsing and HTML generation for all supported formats:

dotnet run -- --test

4. Publish Single-File Release

dotnet publish -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -o publish

The resulting publish\DocViewer.exe is ~8.6 MB and ready for immediate deployment.


📂 Project Structure

doc_viewer/
├── Assets/                        # Embedded webview scripts (docx-preview, jszip)
├── Controls/
│   └── PreviewHandlerHost.cs      # Win32 COM HwndHost for native Windows preview handlers
├── Services/
│   ├── DocumentPreviewService.cs  # Master routing & fallback engine
│   ├── RegistryHelper.cs          # Registry query for COM CLSIDs
│   ├── MarkdownRenderer.cs        # Markdig + GitHub dark/light styling
│   ├── CsvRenderer.cs             # Fast streaming CSV with search & sticky headers
│   ├── ExcelRenderer.cs           # Multi-sheet .xlsx & legacy .xls reader
│   ├── WordRenderer.cs            # Paginated .docx DOM renderer
│   └── PowerPointRenderer.cs      # Slide deck presentation viewer
├── test_samples/                  # Sample test documents (.docx, .xlsx, .pptx, .csv, .md)
├── MainWindow.xaml / .cs          # Fluent UI, Mica backdrop, Drag & Drop
├── App.xaml / .cs                 # Application startup, encoding, and self-test harness
└── DocViewer.csproj               # .NET 10 project definition

Contributors

MashukeAlam

1 commits

MashukeAlam/doc-preview

Lightweight, elegant read-only document previewer for Windows (Office, CSV, Markdown)

C#

0

1 commits

updated Sep 24, 2026

See the code

See what people are saying

SourceMessageScoreDate

Previewing office files (r/SideProject)

Not everyone has MS Office, LibreOffice, WPS office installed and not everyone wants to open a full fledged heavy office suite just to preview the file (be it PPT, DOC, XLX, PDF, MD, CSV)... So here is a very lightweight app (sub 10MB) to just preview the file. Send feedbacks and it's open source -…

1

Sep 24, 2026

README

DocPreview — Lightweight Office & Document Previewer for Windows

DocPreview is an ultra-lightweight, elegant, read-only document previewer for Windows 10 & 11 built with C# (.NET 10) and WPF Fluent Design (Wpf.Ui).

It is designed strictly for instant previewing without the weight, memory consumption, or complexity of full office suites or Chromium/Electron apps.


✨ Key Features

  • ⚡ Ultra-Lightweight & Instant Startup:
    • ~8.6 MB published executable.
    • ~35–50 MB RAM footprint (reuses Windows Edge WebView2 runtime).
    • Sub-100ms document parse and rendering times.
  • 🎨 Modern Windows 11 Fluent UI:
    • Authentic Mica translucent window backdrop.
    • System-synced Dark and Light modes.
    • Frameless title bar with system snap layouts and quick action buttons.
  • 🧠 Smart Dual-Engine Architecture:
    • Engine A (Windows COM IPreviewHandler): Queries the Windows Registry for Microsoft Office preview handlers. If Office is installed, it leverages native COM with 100% fidelity and virtually zero memory overhead.
    • Engine B (High-Fidelity Standalone Engine): If Office is not installed on the system, the app seamlessly falls back to embedded, lightweight standalone parsers running 100% offline.
  • 🖱️ Frictionless UX & Shell Integration:
    • Windows Explorer Right-Click Menu: Right-click any document in Windows Explorer and select "Preview with DocPreview".
    • Drag & Drop: Drop any file directly onto the window.
    • CLI & Shell Integration: Pass file path via arguments (DocViewer.exe "path\to\doc.xlsx").
    • Interactive Controls: Zoom in/out, sheet tabs for Excel, slide carousel for PowerPoint, live filter search for CSV, and "Open with App" shortcut.

📁 Supported File Formats

FormatExtensionRendering PipelineFeatures
Word.docx, .docdocx-preview / COMFull pagination, headers, footers, tables, and images.
Excel.xlsx, .xlsExcelDataReader / COMMulti-sheet interactive tabs, cell formatting, and live search.
PowerPoint.pptx, .pptSlide Deck Engine / COMSlide thumbnails, 16:9 canvas viewer, and arrow key navigation.
Data.csv, .tsvCsvHelper Streaming TableSticky headers, row numbers, sortable columns, and instant filter.
Markdown.md, .markdownMarkdig + GitHub StylingCommonMark/GFM, code blocks, tables, task lists, dark/light themes.

⌨️ Keyboard Shortcuts

ShortcutAction
Ctrl + OOpen file dialog
Ctrl + + / Ctrl + -Zoom In / Zoom Out
Ctrl + 0Reset Zoom to 100%
Ctrl + EOpen current file in default system application
F5Reload preview
Left / Right ArrowPrevious / Next slide (when viewing PowerPoint)

🖱️ Windows Explorer Right-Click Integration

You can preview documents directly by right-clicking on them in Windows File Explorer:

  1. Option A: One-Click Inside the App

    • Click the Add-Ins / Context Menu button (right side of toolbar) in the app to toggle it on or off.
  2. Option B: Run the Included PowerShell Script

    • To enable: powershell -ExecutionPolicy Bypass -File .\register_context_menu.ps1
    • To remove: powershell -ExecutionPolicy Bypass -File .\unregister_context_menu.ps1
  3. Option C: Command-Line Flags

    .\publish\DocViewer.exe --register
    .\publish\DocViewer.exe --unregister
    

🚀 Running & Building

1. Run Development Build

dotnet run

2. Preview a Specific File via Command Line

dotnet run -- "test_samples\budget.xlsx"

3. Run Automated Self-Tests

Verifies document parsing and HTML generation for all supported formats:

dotnet run -- --test

4. Publish Single-File Release

dotnet publish -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -o publish

The resulting publish\DocViewer.exe is ~8.6 MB and ready for immediate deployment.


📂 Project Structure

doc_viewer/
├── Assets/                        # Embedded webview scripts (docx-preview, jszip)
├── Controls/
│   └── PreviewHandlerHost.cs      # Win32 COM HwndHost for native Windows preview handlers
├── Services/
│   ├── DocumentPreviewService.cs  # Master routing & fallback engine
│   ├── RegistryHelper.cs          # Registry query for COM CLSIDs
│   ├── MarkdownRenderer.cs        # Markdig + GitHub dark/light styling
│   ├── CsvRenderer.cs             # Fast streaming CSV with search & sticky headers
│   ├── ExcelRenderer.cs           # Multi-sheet .xlsx & legacy .xls reader
│   ├── WordRenderer.cs            # Paginated .docx DOM renderer
│   └── PowerPointRenderer.cs      # Slide deck presentation viewer
├── test_samples/                  # Sample test documents (.docx, .xlsx, .pptx, .csv, .md)
├── MainWindow.xaml / .cs          # Fluent UI, Mica backdrop, Drag & Drop
├── App.xaml / .cs                 # Application startup, encoding, and self-test harness
└── DocViewer.csproj               # .NET 10 project definition

Contributors

MashukeAlam

1 commits

Languages

C#

83.6%

PowerShell

11.0%

Python

5.2%