ODT and EPUB
Two export-only formats: OpenDocument Text for LibreOffice and OpenOffice, and EPUB 3 for e-readers. Both are written deterministically, so the same document produces the same file every time.
Saving
converter.Save(document, stream, ".odt") and converter.Save(document, stream, ".epub") use the defaults. Pass settings without building a writer:
using DocWright;
using DocWright.Formats.Epub;
using DocWright.Formats.Odt;
// Writer settings without constructing a writer: the format-neutral settings bag.
var epub = new SaveOptions();
epub.FormatSettings[EpubFormatSettingKeys.Title] = "Letterhead";
epub.FormatSettings[EpubFormatSettingKeys.Language] = "en";
epub.FormatSettings[EpubFormatSettingKeys.Split] = "section";
using (FileStream output = File.Create("letterhead-book.epub"))
{
converter.Save(document, output, ".epub", epub);
}
var odt = new SaveOptions();
odt.FormatSettings[OdtFormatSettingKeys.Title] = "Letterhead";
using (FileStream output = File.Create("letterhead-titled.odt"))
{
converter.Save(document, output, ".odt", odt);
}
OpenDocument Text
ODF 1.3 with paragraphs, headings, runs, lists, tables, images, hyperlinks, bookmarks, sections, page size, columns, and headers and footers.
Styles are kept as styles. Word's named styles become ODF named styles, with their inheritance, and direct formatting becomes automatic styles based on them. Change Heading 1 in LibreOffice and every heading follows.
| Setting | OdtFormatSettingKeys |
Default |
|---|---|---|
| Title | Title |
none |
| Embed images | EmbedImages |
true |
| Generator | Generator |
DocWright |
Every exported document is opened by LibreOffice in DocWright's test suite, and its text compared with the source.
EPUB 3
A complete, valid e-book: an OCF container, package document, navigation document, one XHTML file per chapter, a shared stylesheet, and de-duplicated images. Every file is checked with EPUBCheck in DocWright's tests.
| Setting | EpubFormatSettingKeys |
Default |
|---|---|---|
| Title | Title |
from the document |
| Language | Language |
from the document |
| Identifier | Identifier |
derived from the content, so the same book has the same id |
| Chapter split | Split |
Heading; or Section, or WholeDocument (the EpubChapterSplit values) |
| Heading level for splits | HeadingLevel |
1 |
| Modified timestamp | Modified |
2000-01-01T00:00:00Z: set a real one, it is never read from the clock |
Chapters split on document structure, never on pages, which an e-reader doesn't have. Content inherits the HTML writer's losses. Lists and tables that cross a chapter boundary restart in the next chapter. Embedded fonts are not included, because shipping a font inside a book is a licensing decision.