Skip to content

Refactor ClosedXML#235

Merged
rorychatt merged 21 commits into
mainfrom
refactor-closedxml
Oct 12, 2025
Merged

Refactor ClosedXML#235
rorychatt merged 21 commits into
mainfrom
refactor-closedxml

Conversation

@ArtemLazarchuk

Copy link
Copy Markdown
Collaborator

ClosedXML

image image

One-Click Development Environment

Open in GitHub Codespaces

Click the badge above to open Ivy Examples repository in GitHub Codespaces with:

  • .NET 9.0 SDK pre-installed
  • Ready-to-run development environment
  • No local setup required

Created Using Ivy

Web application created using Ivy-Framework.

Ivy - The ultimate framework for building internal tools with LLM code generation by unifying front-end and back-end into a single C# codebase. With Ivy, you can build robust internal tools and dashboards using C# and AI assistance based on your existing database.

Ivy is a web framework for building interactive web applications using C# and .NET.

Interactive Example For Excel File Management

This example demonstrates Excel workbook management using the ClosedXML library integrated with Ivy. ClosedXML is a .NET library for reading, manipulating, and writing Excel 2007+ (.xlsx, .xlsm) files without requiring Excel to be installed.

What This Application Does:

This implementation creates two integrated applications for comprehensive Excel file management:

Workbooks Viewer

  • File Selection: Choose from available workbooks via dropdown menu
  • Data Preview: View table data with automatic row limiting for performance
  • Refresh Button: Update file list to see newly created workbooks
  • Clean Interface: Split-panel layout with file selection and data preview

Workbooks Editor

  • Blade-Based Interface: Modern multi-panel interface for managing multiple workbooks
  • Create Workbooks: Add new Excel files with custom names
  • Add Columns: Create new columns with type selection (string, int, double, decimal, long)
  • Add Rows: Insert data rows with automatic validation
  • Auto-Save: Changes are automatically saved to in-memory workbooks
  • Delete Workbooks: Remove files with confirmation dialog
  • Real-Time Updates: See changes reflected immediately in the interface

Technical Implementation:

  • Uses ClosedXML's XLWorkbook class for Excel file manipulation
  • Implements in-memory workbook storage via singleton WorkbookRepository
  • Converts Excel tables to DataTable for easy manipulation
  • Handles multiple file formats and column types
  • Creates blade-based navigation for seamless multi-file editing
  • Implements sample data initialization with Employees, Products, and Sales workbooks
  • Uses Ivy's reactive state management for real-time UI updates
  • Integrates refresh tokens for manual data synchronization
  • Built with two main C# views:
    • Apps/WorkbooksViewerApp.cs - Simple viewer for data preview
    • Apps/WorkbooksEditorApp.cs - Full-featured editor with blade navigation

Key Features:

  • Type-Safe Column Creation: Support for multiple data types with automatic conversion
  • Empty Row Filtering: Automatically removes empty rows from imported data
  • Singleton Pattern: Shared repository ensures consistent data across all app instances
  • Validation: File name validation with invalid character detection
  • Worksheet Management: Automatic table creation and management within worksheets
  • In-Memory Storage: No physical files created - all data stored in memory for fast access

How to Run

  1. Prerequisites: .NET 9.0 SDK
  2. Navigate to the example:
    cd closedxml
  3. Restore dependencies:
    dotnet restore
  4. Run the application:
    dotnet watch
  5. Open your browser to the URL shown in the terminal (typically http://localhost:5010)

How to Deploy

Deploy this example to Ivy's hosting platform:

  1. Navigate to the example:
    cd closedxml
  2. Deploy to Ivy hosting:
    ivy deploy

This will deploy your Excel workbook management application with a single command.

Learn More

@ArtemLazarchuk ArtemLazarchuk self-assigned this Oct 11, 2025
@rorychatt
rorychatt requested a review from Copilot October 11, 2025 15:33
@rorychatt

Copy link
Copy Markdown
Collaborator

@claude review this

Copilot AI 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.

Pull Request Overview

This PR performs a comprehensive refactor of the ClosedXML example application, reorganizing the codebase with improved architecture and modern UI patterns. The refactor moves from a single-app approach to a dual-app system with enhanced functionality.

  • Refactored the application from a single-view Excel editor to two specialized applications: a Workbooks Viewer and a Workbooks Editor
  • Implemented blade-based navigation for the editor with improved user experience
  • Added comprehensive document metadata management through a new DocumentStorage service

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
closedxml/Services/DocumentStorage.cs New service for thread-safe in-memory document metadata storage with CRUD operations
closedxml/Models/Document.cs New model class representing Excel document metadata with formatted properties
closedxml/Apps/WorkbooksViewerApp.cs New viewer app with file selection dropdown and data preview functionality
closedxml/Apps/WorkbooksEditorApp.cs New blade-based editor app with comprehensive workbook management features
closedxml/Connections/IvyClosedXml/WorkbookRepository.cs Enhanced repository with improved data handling and singleton pattern
closedxml/Connections/IvyClosedXml/WorkbookConnection.cs Updated connection with shared repository instance and sample data initialization
closedxml/Program.cs Added custom header with GitHub Codespaces badge and source code link
closedxml/GlobalUsings.cs Updated namespace from IvyClosedXml to ClosedXmlExample
Multiple old view files Removed legacy view components replaced by new blade-based architecture

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread closedxml/Connections/IvyClosedXml/WorkbookConnection.cs Outdated
Comment thread closedxml/Connections/IvyClosedXml/WorkbookConnection.cs Outdated
Comment thread closedxml/Connections/IvyClosedXml/WorkbookConnection.cs Outdated
Comment thread closedxml/Services/DocumentStorage.cs Outdated
@rorychatt

Copy link
Copy Markdown
Collaborator

@ArtemLazarchuk bad commit message
image

@rorychatt
rorychatt merged commit 7e593e0 into main Oct 12, 2025
64 checks passed
@rorychatt
rorychatt deleted the refactor-closedxml branch October 15, 2025 06:41
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.

3 participants