Skip to content

EvotecIT/OfficeIMO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5,645 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OfficeIMO - Office and document libraries for .NET

CI codecov license

Blog LinkedIn Discord

OfficeIMO is a family of COM-free .NET libraries for creating, reading, converting, and exporting Office and document formats. The packages are designed for services, desktop apps, build agents, and automation hosts where Microsoft Office automation is not available or not appropriate.

If OfficeIMO saves you time, please consider supporting the work through GitHub Sponsors or PayPal. Sponsorship helps keep the libraries maintained, tested, and MIT licensed.

PowerShell users should start with EvotecIT/PSWriteOffice, which is the PowerShell-facing project built around OfficeIMO.

Main packages

Package Purpose
OfficeIMO.Word Create, edit, inspect, and convert .docx documents.
OfficeIMO.Excel Create and modify .xlsx workbooks, worksheets, tables, ranges, styles, and reports.
OfficeIMO.PowerPoint Generate .pptx presentations programmatically.
OfficeIMO.Visio Create, inspect, validate, and export .vsdx diagrams without Visio automation.
OfficeIMO.Pdf Dependency-free PDF creation, reading, inspection, page operations, and converter engine support.
OfficeIMO.Rtf Dependency-free RTF parser, syntax tree, fluent document model, and writer.
OfficeIMO.Markdown Typed Markdown AST, builder API, reader, and HTML renderer.
OfficeIMO.Reader Unified read-only extraction facade with modular adapters.

Converters and adapters

Package Purpose
OfficeIMO.Word.Html Word to/from HTML conversion.
OfficeIMO.Word.Markdown Word to/from Markdown conversion.
OfficeIMO.Word.Pdf Word to PDF through OfficeIMO.Pdf.
OfficeIMO.Word.Rtf Word to/from RTF through OfficeIMO.Rtf.
OfficeIMO.Excel.Pdf Excel workbook to PDF through OfficeIMO.Pdf.
OfficeIMO.PowerPoint.Pdf PowerPoint presentation to PDF through OfficeIMO.Pdf.
OfficeIMO.Markdown.Html HTML to Markdown document conversion.
OfficeIMO.Markdown.Pdf Markdown to PDF through OfficeIMO.Pdf.
OfficeIMO.Html.Pdf HTML to PDF and PDF to HTML through OfficeIMO document models.
OfficeIMO.Html Shared HTML ingestion plus HTML to/from RTF through OfficeIMO.Rtf.
OfficeIMO.Rtf.Pdf RTF to/from PDF through the dependency-free OfficeIMO.Pdf engine.

Markdown, markup, and rendering

Package Purpose
OfficeIMO.Markup Markdown-inspired semantic authoring model for OfficeIMO documents.
OfficeIMO.Markup.Word Render markup documents to Word.
OfficeIMO.Markup.Excel Render markup documents to Excel workbooks.
OfficeIMO.Markup.PowerPoint Render markup documents to PowerPoint presentations.
OfficeIMO.Markup.Cli CLI parser, validator, preview, and code-emission tooling.
OfficeIMO.MarkdownRenderer Browser/WebView-friendly Markdown rendering shell.
OfficeIMO.MarkdownRenderer.Wpf WPF/WebView2 Markdown host control.
OfficeIMO.MarkdownRenderer.IntelligenceX IntelligenceX renderer feature pack.
OfficeIMO.MarkdownRenderer.SamplePlugin Sample third-party-style renderer plug-in package.

Reader family

Package Purpose
OfficeIMO.Reader Common extraction model and folder/stream helpers.
OfficeIMO.Reader.Csv CSV/TSV reader adapter.
OfficeIMO.Reader.Epub EPUB reader adapter.
OfficeIMO.Reader.Html HTML reader adapter.
OfficeIMO.Reader.Json JSON reader adapter.
OfficeIMO.Reader.Pdf PDF reader adapter.
OfficeIMO.Reader.Rtf RTF reader adapter.
OfficeIMO.Reader.Text Structured text compatibility adapter.
OfficeIMO.Reader.Visio Visio inspection snapshot adapter.
OfficeIMO.Reader.Xml XML reader adapter.
OfficeIMO.Reader.Yaml YAML reader adapter.
OfficeIMO.Reader.Zip ZIP traversal reader adapter.

Google Workspace and primitives

Package Purpose
OfficeIMO.GoogleWorkspace Shared Google Workspace credentials, sessions, retry, Drive location, and translation reporting.
OfficeIMO.Word.GoogleDocs Word to Google Docs planning and export scaffolding.
OfficeIMO.Excel.GoogleSheets Excel to Google Sheets planning and export scaffolding.
OfficeIMO.CSV Fluent CSV document model.
OfficeIMO.Drawing Shared color, image, font, and drawing primitives.
OfficeIMO.Zip Safe ZIP traversal primitives.
OfficeIMO.Epub EPUB extraction primitives.

Install

Install only the packages you need:

dotnet add package OfficeIMO.Word
dotnet add package OfficeIMO.Excel
dotnet add package OfficeIMO.PowerPoint
dotnet add package OfficeIMO.Pdf

Converter packages are intentionally separate so applications can opt into the extra dependency surface only when needed:

dotnet add package OfficeIMO.Word.Pdf
dotnet add package OfficeIMO.Excel.Pdf
dotnet add package OfficeIMO.Markdown.Pdf

Quick example

using OfficeIMO.Word;

using var document = WordDocument.Create("report.docx");
document.AddParagraph("OfficeIMO").SetBold();
document.AddParagraph("Created without Microsoft Office automation.");
document.Save();

Common workflows

Create an Excel report

using OfficeIMO.Excel;

using var workbook = ExcelDocument.Create("sales.xlsx");
var sheet = workbook.AddWorkSheet("Sales");

sheet.CellValue(1, 1, "Product");
sheet.CellValue(1, 2, "Revenue");
sheet.CellValue(2, 1, "Alpha");
sheet.CellValue(2, 2, 120);
sheet.CellValue(3, 1, "Beta");
sheet.CellValue(3, 2, 92);
sheet.AddTable("A1:B3", hasHeader: true, name: "SalesTable", style: TableStyle.TableStyleMedium2);
sheet.AutoFitColumns();

workbook.Save();

Parse CSV into typed objects

using OfficeIMO.CSV;

List<Person> people = CsvDocument.Load("people.csv")
    .EnsureSchema(schema => schema
        .Column("Id").AsInt32().Required()
        .Column("Name").AsString().Required())
    .ValidateOrThrow()
    .Map<Person>(map => map
        .FromColumn<int>("Id", (person, value) => { person.Id = value; return person; })
        .FromColumn<string>("Name", (person, value) => { person.Name = value; return person; }))
    .ToList();

public sealed class Person {
    public int Id { get; set; }
    public string Name { get; set; } = "";
}

Export Word to PDF

using OfficeIMO.Word;
using OfficeIMO.Word.Pdf;

using var document = WordDocument.Load("proposal.docx");
document.SaveAsPdf("proposal.pdf");

Read, split, merge, and stamp PDFs

using OfficeIMO.Pdf;

using var source = PdfDocument.Open("packet.pdf");

string firstPageText = source.Read.Text("1");
source.Pages.Extract("1-3").Save("packet-summary.pdf");

PdfDocument.Open("packet.pdf")
    .MergeWith("appendix.pdf")
    .Pages.Delete("2")
    .Stamp.Text("Reviewed")
    .Save("packet-final.pdf");

Convert PDF tables back into editable Office files

using OfficeIMO.Excel.Pdf;
using OfficeIMO.Word.Pdf;

PdfExcelTableConverterExtensions.SavePdfTablesAsExcel(
    "statement.pdf",
    "statement-tables.xlsx");

PdfWordTableConverterExtensions.SavePdfTablesAsWord(
    "statement.pdf",
    "statement-tables.docx");

Convert Markdown and HTML to PDF

using OfficeIMO.Markdown.Pdf;

"# Status\n\nGenerated by OfficeIMO.".SaveAsPdf("status.pdf");
using OfficeIMO.Html.Pdf;

"<h1>Status</h1><p>Generated by OfficeIMO.</p>"
    .SaveAsPdf("status-html.pdf", HtmlPdfSaveOptions.CreateDocumentProfile());

Extract content for indexing or RAG

using OfficeIMO.Reader;
using OfficeIMO.Reader.Pdf;
using OfficeIMO.Reader.Zip;

DocumentReaderPdfRegistrationExtensions.RegisterPdfHandler();
DocumentReaderZipRegistrationExtensions.RegisterZipHandler();

var chunks = DocumentReader.ReadFolder("KnowledgeBase",
    new ReaderFolderOptions {
        Recurse = true,
        MaxFiles = 500,
        DeterministicOrder = true
    },
    new ReaderOptions {
        MaxChars = 8_000,
        ComputeHashes = true
    }).ToList();

Create a Visio diagram

using OfficeIMO.Visio;
using OfficeIMO.Visio.Diagrams;

VisioDocument.Create("network.vsdx")
    .NetworkTopologyDiagram("Branch topology", topology => topology
        .Title()
        .Root("internet", "Internet", VisioNetworkNodeKind.Internet)
        .Firewall("firewall", "Firewall")
        .Switch("core", "Core Switch")
        .Server("app", "App Server")
        .Ethernet("internet", "firewall", "WAN")
        .Trunk("firewall", "core")
        .Trunk("core", "app"))
    .Save();

Target frameworks

Most shipping libraries target netstandard2.0, net8.0, and net10.0. Some packages also include net472 or Windows-specific targets where the surface requires it. Check the package README or project file for exact targets.

Deeper docs

About

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors