# evotecit/officeimo architecture

> Architecture diagram of the GitHub repository evotecit/officeimo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/evotecit/officeimo
- Repository: https://github.com/evotecit/officeimo

## Overview

##### Main components
- Core Libraries:
- OfficeIMO.Word – contains the main classes for creating, editing, and saving Word documents. It is split across several files handling properties, sections, paragraphs, headers/footers, tables, images, and so on.
- OfficeIMO.Excel – provides similar functionality for Excel documents.
- Helper Components:
- Helpers, Extensions, and Cloners – utility classes that encapsulate common logic (e.g., converting properties, fixing packages, implementing image handling).
- Enumerations and static classes (like WordListStyle, JustificationValues) used across the system.
- Exception Handling:
- Custom exceptions such as OfficeIMOException, ImageFormatNotSupportedException, etc.
- Test Suites:
- OfficeIMO.Tests – unit tests and test documents to ensure functionality.
- OfficeIMO.VerifyTests – characterization tests using snapshot testing to track output/document structure.
- Build & Documentation:
- Build scripts (PowerShell scripts for building packages, documentation, publishing, etc.)
- Documentation (the Docs directory with examples and technical guides).

##### Relationships and interactions
- The core OfficeIMO libraries are the heart of the system and consume the OpenXML SDK (although not directly visible in the file tree, it’s mentioned as a dependency in the README).
- The library exposes a public API that the sample applications (found in OfficeIMO.Examples) and the tests (OfficeIMO.Tests and OfficeIMO.VerifyTests) use to create, modify, and validate documents.
- Utility classes within OfficeIMO.Word (like Helpers, Extensions, and specific classes for Table management, Field handling, Header/Footer, etc.) work in close collaboration with the document classes (like WordDocument, WordSection, WordParagraph) to perform specific operations.
- The build system (Build directory and Azure pipeline YAML files) automates building, testing, and packaging the library for different platforms.
- Documentation and examples serve as integration guides for using the library.

##### Architectural Patterns and Design Principles
- Modular Design: The project is split into multiple modules (Word, Excel, Examples, Tests), keeping core logic separated from examples and tests.
- Layered Architecture: The system has a clear separation between low-level document manipulation (using OpenXML) and higher-level abstractions (OfficeIMO.Word classes) which are then used by client code.
- Extension Methods and Helpers: These patterns simplify operations by extending the base classes for properties and functionalities.
- Test Driven / Characterization Testing: The tests ensure that even with changes the behavior is consistent, highlighting an emphasis on stability.

##### Relevant Technologies
- .NET Framework versions support (.NET 4.7.2, .NET 6.0, .NET 7.0, .NET 8.0, .NET Standard 2.0/2.1).
- OpenXML SDK – as an underlying document manipulation technology.
- Azure Pipelines – for continuous integration and build automation.
- VerifyTests – for snapshot/characterization testing.

##### Specific elements
- Core library modules (e.g., WordDocument, WordSection, WordParagraph).
- Utility components (Helpers, Extensions, Enums).
- Testing frameworks and build automation.
- External dependencies (OpenXML SDK, CI/CD pipelines).
- Optionally, illustrate the layering (e.g., bottom layer: OpenXML SDK, middle layer: OfficeIMO core libraries, top layer: examples/tests).

End of explanation.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% API Consumers Layer
    subgraph "API Consumers"
        Examples["\"OfficeIMO.Examples\""]:::consumers
        Tests["\"OfficeIMO.Tests\""]:::consumers
        Verify["\"OfficeIMO.VerifyTests\""]:::consumers
    end

    %% Core Libraries Layer
    subgraph "Core Libraries"
        Word["\"OfficeIMO.Word\""]:::core
        Excel["\"OfficeIMO.Excel\""]:::core
        Helpers["\"Helpers & Extensions\""]:::core
        Enums["\"Enumerations\""]:::core
        Exceptions["\"Custom Exceptions\""]:::core
    end

    %% Build & Documentation Layer
    subgraph "DevOps & Docs"
        Build["\"Build Scripts\""]:::devops
        Docs["\"Documentation & Guides\""]:::devops
    end

    %% External Dependency Layer
    OpenXML["\"OpenXML SDK\""]:::external

    %% Relationships from API Consumers to Core Libraries
    Examples -->|"uses"| Word
    Examples -->|"uses"| Excel
    Tests -->|"uses"| Word
    Tests -->|"uses"| Excel
    Verify -->|"uses"| Word
    Verify -->|"uses"| Excel

    %% Core Libraries internal relationships
    Word -->|"utilizes"| Helpers
    Word -->|"utilizes"| Enums
    Word -->|"handles"| Exceptions
    Excel -->|"utilizes"| Helpers

    %% Core Libraries dependency on external
    Word -->|"wraps"| OpenXML
    Excel -->|"wraps"| OpenXML

    %% Build & Docs relationships
    Build -->|"builds/tests"| Word
    Build -->|"builds/tests"| Excel
    Docs -->|"documents"| Word
    Docs -->|"documents"| Excel

    %% Vertical layering ordering
    Examples --- Word
    Word --- Build
    Build --- OpenXML

    %% Click Events
    click Word "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Word"
    click Excel "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Excel"
    click Helpers "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Word/Helpers.cs"
    click Enums "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Word/Enumerations.cs"
    click Exceptions "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Word/Exceptions/OfficeIMOException.cs"
    click Tests "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Tests"
    click Verify "https://github.com/evotecit/officeimo/tree/master/OfficeIMO.VerifyTests/Word"
    click Build "https://github.com/evotecit/officeimo/tree/master/Build"
    click Docs "https://github.com/evotecit/officeimo/blob/master/Docs/index.md"
    click Examples "https://github.com/evotecit/officeimo/blob/master/OfficeIMO.Examples"

    %% Styling classes
    classDef core fill:#f9f,stroke:#333,stroke-width:2px;
    classDef consumers fill:#bbf,stroke:#333,stroke-width:2px;
    classDef devops fill:#efe,stroke:#333,stroke-width:2px;
    classDef external fill:#fcc,stroke:#333,stroke-width:2px;
```
