diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-05-07 23:13:50 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-05-07 23:13:50 +0100 |
| commit | 17d1a1f710edd8dfb92e75bcd273e04cee7c8146 (patch) | |
| tree | 0a6b697f068e8de0996774278cddafa512c3d9a7 | |
| parent | 3e5b4e357e027547ac82c4d7f6316e80f103a11b (diff) | |
Add README.md
| -rw-r--r-- | README.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9b4a05 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# dotnet-mammoth: .docx to HTML converter + +This project uses [Edge.js](http://tjanczuk.github.io/edge/) to allow [mammoth.js](https://github.com/mwilliamson/mammoth.js) to be used from .NET. + +Mammoth is designed to convert .docx documents, such as those created by Microsoft Word, and convert them to HTML. Mammoth aims to produce simple and clean HTML by using semantic information in the document, and ignoring other details. For instance, Mammoth converts any paragraph with the style `Heading 1` to `h1` elements, rather than attempting to exactly copy the styling (font, text size, colour, etc.) of the heading. + +There's a large mismatch between the structure used by .docx and the structure of HTML, meaning that the conversion is unlikely to be perfect for more complicated documents. Mammoth works best if you only use styles to semantically mark up your document. + +## Installation + +Install the package `Mammoth` from NuGet. + +## Usage + +Only the bare minimum case is currently supported: + +```csharp +var documentConverter = new Mammoth.DocumentConverter(); +var result = documentConverter.ConvertToHtml(@"path/to/document.docx"); +// result.Value contains the HTML output +// result.Messages contains any messages produced during the conversion, +// such as warnings about unrecognised paragraph styles. +``` + +However, adding support for features that already exist in mammoth.js should be fairly straightforward, +so feel free to file a bug or pull request for any such feature (or any other feature, for that matter). |
