OneDocument is Recursive AI’s free, open-source .NET library (MIT or Apache-2.0). It reads and writes ODT, OTT, and FODT. NuGet · GitHub · Docs
dotnet new console dotnet add package RecursiveAI.OneDocument.Documents --version 1.0.0
Download features.fodt into the project folder and keep its original name.
Replace Program.cs and run dotnet run.
using RecursiveAI.OneDocument.Documents; using var doc = Document.Open("features.fodt"); Console.WriteLine(doc.Format);
FodtWhat’s the difference between ODT, OTT, and FODT?
ODT and OTT normally use the same kind of ZIP container, but the media type inside says whether the package holds a document or a template. FODT puts the document and its styles in a single XML file instead. The ODF package specification defines the package format; OneDocument’s ODF notes describe how it reads both forms.
LibreOffice Writer saves ODT by default, Microsoft Word can open it, and Google Docs can import it.
ODS is an OpenDocument spreadsheet and ODP is an OpenDocument presentation. They belong to the same family, but they don’t hold the same kind of content. DOCX is a word-processing format too, but it belongs to Office Open XML, not OpenDocument. Both ODT and DOCX are normally ZIP packages, so seeing a ZIP header isn’t enough to tell them apart.
How can you tell what format the file really is?
OneDocument’s Document.Open identifies an ODF text document from the mimetype entry in a package or the office:mimetype attribute in flat XML. The extension isn’t used for this decision. Encrypted ODF packages aren’t supported: they raise OfficeUnsupportedException (ODF read behavior).
For the next example, copy features.fodt to sample.bin. The new extension hides the file type from its name, but the root element still has office:mimetype="application/vnd.oasis.opendocument.text".
Does saving keep the original bytes?
Replace Program.cs with this longer example and run dotnet run to compare an untouched save with a conversion.
using RecursiveAI.OneDocument.Documents; // A copy of the pinned features.fodt fixture, renamed. const string input = "sample.bin"; using var doc = Document.Open(input); Console.WriteLine($"Detected: {doc.Format}"); Console.WriteLine($"Import loss entries: {doc.ImportLoss?.Items.Count ?? 0}"); doc.SaveAs("copy.fodt"); byte[] original = File.ReadAllBytes(input); byte[] copy = File.ReadAllBytes("copy.fodt"); Console.WriteLine($"Untouched copy matches: {original.SequenceEqual(copy)}"); doc.SaveAs("converted.odt"); using var converted = Document.Open("converted.odt"); Console.WriteLine($"Converted to: {converted.Format}"); Console.WriteLine($"Export loss entries: {doc.ExportLoss?.Items.Count ?? 0}");
Detected: Fodt Import loss entries: 3 Untouched copy matches: True Converted to: Odt Export loss entries: 0
The three import entries are tracked formatting changes (the formatting itself stays), drawing shapes (their text stays), and linked pictures (not fetched).
With OneDocument, an untouched document saved in its original format gets its original bytes back. If you edit it, or change from FODT to ODT as above, the exporter builds the output from OneDocument’s internal DOCX model. That means an untouched copy and a converted file can differ even when you haven’t changed the text (save behavior).
ImportLoss records what didn’t map into that model. For example, embedded charts can keep only their preview image. ExportLoss records losses from writing the model out to ODF; an equation, for example, can become linear text. The example counts report entries, not affected objects. Zero export entries don’t undo the three import entries, and those import entries don’t stop an untouched copy from preserving the original bytes (import and export mappings).