# Convert OpenDocument to and from Office

Convert ODT to DOCX, ODS to XLSX and ODP to PPTX and back, and read the per-feature report of what was mapped, approximated or lost.

**Packages**

- [OfficeIMO.Word.OpenDocument](https://www.nuget.org/packages/OfficeIMO.Word.OpenDocument) `dotnet add package OfficeIMO.Word.OpenDocument`
- [OfficeIMO.Excel.OpenDocument](https://www.nuget.org/packages/OfficeIMO.Excel.OpenDocument) `dotnet add package OfficeIMO.Excel.OpenDocument`
- [OfficeIMO.PowerPoint.OpenDocument](https://www.nuget.org/packages/OfficeIMO.PowerPoint.OpenDocument) `dotnet add package OfficeIMO.PowerPoint.OpenDocument`

**Works with**

- .NET
- [PowerShell](/docs/pswriteoffice/install/) `Install-Module PSWriteOffice`
- [CLI](/docs/cli/install/) `dotnet tool install --global OfficeIMO.Tool`

**Target frameworks**

netstandard2.0, net8.0, net10.0, net472

**APIs**

- [`OdtDocument`](/api/open-document/officeimo-opendocument-odtdocument/)
- [`ExcelDocument`](/api/excel/officeimo-excel-exceldocument/)
- [`PowerPointDocument`](/api/powerpoint/officeimo-powerpoint-powerpointdocument/)
- [`WordDocument`](/api/word/officeimo-word-worddocument/)
- [`OdpPresentation`](/api/open-document/officeimo-opendocument-odppresentation/)
- [`OdsDocument`](/api/open-document/officeimo-opendocument-odsdocument/)
- [`ExcelOpenDocumentConversionOptions`](/api/excel-open-document/officeimo-excel-opendocument-excelopendocumentconversionoptions/)
- [`OdfConversionReport`](/api/open-document/officeimo-opendocument-odfconversionreport/)
- [`OfficeConversionReport`](/api/core/officeimo-officeconversionreport/)
- [`OdfConversionLossPolicy`](/api/open-document/officeimo-opendocument-odfconversionlosspolicy/)
- [`OdfConversionMapping`](/api/open-document/officeimo-opendocument-odfconversionmapping/)
- [`OdfConversionMappingStatus`](/api/open-document/officeimo-opendocument-odfconversionmappingstatus/)

**Cmdlets**

- [`Convert-OfficeDocument`](/api/powershell/convert-officedocument/)
- [`New-OfficeWordOpenDocumentOptions`](/api/powershell/new-officewordopendocumentoptions/)
- [`New-OfficeExcelOpenDocumentOptions`](/api/powershell/new-officeexcelopendocumentoptions/)
- [`New-OfficePowerPointOpenDocumentOptions`](/api/powershell/new-officepowerpointopendocumentoptions/)

**Commands**

- [`officeimo convert`](/docs/cli/convert/)

**Limits**

Conversion maps a documented feature subset; tracked changes, charts, SmartArt, content controls and section-specific layout are reported as loss rather than carried over. [OfficeIMO.Word.OpenDocument support matrix](/compatibility/#package-word-opendocument), [OfficeIMO.Excel.OpenDocument support matrix](/compatibility/#package-excel-opendocument), [OfficeIMO.PowerPoint.OpenDocument support matrix](/compatibility/#package-powerpoint-opendocument)

**Verified**

Examples compiled against the source on 2026-11-14

**Data**

- [OfficeIMO.Word.OpenDocument API index](/api/word-open-document/index.json)
- [OfficeIMO.Excel.OpenDocument API index](/api/excel-open-document/index.json)
- [OfficeIMO.PowerPoint.OpenDocument API index](/api/power-point-open-document/index.json)
- [PSWriteOffice command catalog](/data/powershell/commands.json)
- [CLI command catalog](/data/cli/commands.json)
- [Capability catalog (JSON)](/data/capabilities.json)

Each Office format has its own adapter package, so a Word-only application does not carry the Excel or PowerPoint engines. Conversion is explicit and returns an `OdfConversionReport` that lists every feature as converted, approximated, skipped or unsupported, so a pipeline can reject unexpected changes instead of trusting a successful save.

| From | To | Package | Methods |
|---|---|---|---|
| `WordDocument` | ODT | `OfficeIMO.Word.OpenDocument` | `ToOpenDocument`, `SaveAsOpenDocument` |
| `OdtDocument` | DOCX | `OfficeIMO.Word.OpenDocument` | `ToWord`, `SaveAsWord` |
| `ExcelDocument` | ODS | `OfficeIMO.Excel.OpenDocument` | `ToOpenDocument`, `SaveAsOpenDocument` |
| `OdsDocument` | XLSX | `OfficeIMO.Excel.OpenDocument` | `ToExcel`, `SaveAsExcel` |
| `PowerPointDocument` | ODP | `OfficeIMO.PowerPoint.OpenDocument` | `ToOpenDocument`, `SaveAsOpenDocument` |
| `OdpPresentation` | PPTX | `OfficeIMO.PowerPoint.OpenDocument` | `ToPowerPoint`, `SaveAsPowerPoint` |

Every method has an `Async` form and a stream overload.

## Convert Word to ODT and back

### C#

```csharp
using OfficeIMO;
using OfficeIMO.OpenDocument;
using OfficeIMO.Word;
using OfficeIMO.Word.OpenDocument;

using (WordDocument word = WordDocument.Load("report.docx")) {
    using OdtDocument odt = word.ToOpenDocument(null, out OfficeConversionReport report);
    odt.Save("report.odt");

    foreach (OdfConversionMapping mapping in ((OdfConversionReport)report).Mappings) {
        if (mapping.Status != OdfConversionMappingStatus.Converted) {
            Console.WriteLine($"{mapping.Feature}: {mapping.Status} ({mapping.Count}) {mapping.Message}");
        }
    }
}

using (OdtDocument source = OdtDocument.Load("proposal.odt")) {
    OfficeConversionReport saved = source.SaveAsWord("proposal.docx");
    Console.WriteLine(saved.HasLoss ? "Converted with loss" : "Converted");
}
```

The Word adapter maps headings, paragraphs and their formatting, lists, tables and merges, inline images, hyperlinks, bookmarks, page layout, default and first-page headers and footers, footnotes and endnotes, and page number, page count, date and time fields.

### PowerShell

```powershell
Convert-OfficeDocument -Path ./report.docx -OutputPath ./report.odt
Convert-OfficeDocument -Path ./proposal.odt -OutputPath ./proposal.docx -FailOnLoss

$options = New-OfficeWordOpenDocumentOptions -NoImages -NoHeadersAndFooters
Convert-OfficeDocument -Path ./report.docx -To OpenDocument -OutputPath ./report.odt -Options $options
```

### CLI

```sh
officeimo convert report.docx report.odt
officeimo convert proposal.odt proposal.docx --require-no-loss
```

## Convert Excel to ODS and back

### C#

```csharp
using OfficeIMO;
using OfficeIMO.Excel;
using OfficeIMO.Excel.OpenDocument;
using OfficeIMO.OpenDocument;

using (ExcelDocument workbook = ExcelDocument.Load("report.xlsx")) {
    OfficeConversionReport report = workbook.SaveAsOpenDocument("report.ods", new ExcelOpenDocumentConversionOptions {
        LossPolicy = OdfConversionLossPolicy.ThrowOnSkippedOrUnsupported
    });
    Console.WriteLine($"{report.Diagnostics.Count} diagnostics");
}

using (OdsDocument source = OdsDocument.Load("budget.ods"))
using (ExcelDocument converted = source.ToExcel()) {
    converted.Save("budget.xlsx");
}
```

The Excel adapter maps worksheets, typed values, formulas (translated structurally between A1 and OpenFormula syntax), hyperlinks, comments, merges, row and column layout, named ranges, number formats, a basic style subset, common validations, simple charts and pivot tables. `ExcelOpenDocumentConversionOptions` bounds rows, columns and converted cells; content outside those limits is reported as `Skipped`.

### PowerShell

```powershell
$options = New-OfficeExcelOpenDocumentOptions -IncludeBasicStyles -MaximumRows 10000 -MaximumColumns 100
Convert-OfficeDocument -Path ./report.xlsx -OutputPath ./report.ods -Options $options
Convert-OfficeDocument -Path ./budget.ods -OutputPath ./budget.xlsx
```

### CLI

```sh
officeimo convert report.xlsx report.ods
officeimo convert budget.ods budget.xlsx
```

## Convert PowerPoint to ODP and back

### C#

```csharp
using OfficeIMO;
using OfficeIMO.OpenDocument;
using OfficeIMO.PowerPoint;
using OfficeIMO.PowerPoint.OpenDocument;

using (PowerPointDocument deck = PowerPointDocument.Load("deck.pptx")) {
    deck.SaveAsOpenDocument("deck.odp");
}

using (OdpPresentation source = OdpPresentation.Load("slides.odp")) {
    using PowerPointDocument converted = source.ToPowerPoint(null, out OfficeConversionReport report);
    converted.Save("slides.pptx");
    report.ThrowIfLoss();   // fail the job if anything was approximated or dropped
}
```

The PowerPoint adapter maps slide size and order, hidden slides, text boxes and runs, images and crops, tables, basic shapes, solid backgrounds, common transitions, speaker notes, and master and layout associations with common placeholder roles.

### PowerShell

```powershell
$options = New-OfficePowerPointOpenDocumentOptions -NoSpeakerNotes
Convert-OfficeDocument -Path ./deck.pptx -To OpenDocument -Options $options
```

### CLI

```sh
officeimo convert deck.pptx deck.odp
officeimo convert slides.odp slides.pptx
```

## Reject conversions that lose content

Set `LossPolicy` on the adapter options to make a conversion throw instead of returning a lossy result. `ThrowOnSkippedOrUnsupported` accepts documented approximations; `ThrowOnAnyLoss` rejects those too.

### C#

```csharp
using OfficeIMO.OpenDocument;
using OfficeIMO.Word;
using OfficeIMO.Word.OpenDocument;

var options = new WordOpenDocumentConversionOptions { LossPolicy = OdfConversionLossPolicy.ThrowOnAnyLoss };

using OdtDocument source = OdtDocument.Load("contract.odt");
try {
    using WordDocument word = source.ToWord(options);
    word.Save("contract.docx");
} catch (Exception exception) {
    Console.WriteLine("Not converted: " + exception.Message);
}
```

### PowerShell

```powershell
Convert-OfficeDocument -Path ./contract.odt -OutputPath ./contract.docx -FailOnLoss
```

### CLI

```sh
officeimo convert contract.odt contract.docx --require-no-loss
```

<!-- PowerForge markdown source sha256:F2E0D9ED7158E58354E2A0D9CF8BC0B5EE58A8F6736334BC900DEB73E0EE2C16; title=True -->

<!-- PowerForge markdown artifact sha256:44B3C24841FDC4BB74C04249A5AFAF43035BE99E212EFAF06BE27F8C0F6DD847 -->
