1. Products
  2.   Word Processing
  3.   .NET
  4.   Dotnet-Mammoth
 
  

C# .NET Library for Creating Word Processing Documents

Open source C# .NET API enables Software Developers to Load and convert Microsoft Word, Google Docs and LibreOffice documents to HTML for free.

What is Dotnet-Mammoth?

In the modern world of information exchange, the ability to seamlessly convert documents from one format to another has become paramount. Whether it's for archiving, sharing, or even just maintaining the integrity of data, having a reliable document conversion tool can make all the difference. This is where the Dotnet-Mammoth library comes into play, offering a powerful and versatile solution for converting documents with ease. By using the library users can convert historical documents or important records into accessible and searchable HTML files.

The Dotnet-Mammot library is a .NET wrapper around the popular mammoth.js JavaScript library. Its main purpose is to simplify the process of converting complex documents, primarily DOCX and DOC files, into HTML, allowing for a smooth transition between different formats. This can be especially handy when dealing with documents in applications where HTML is the preferred medium, such as web applications or content management systems. It supports features like headings, lists, customizable mapping support, formatting of the table, footnotes and endnotes, images, links, line breaks, text boxes, comments, bold/italic/underline, strikethrough, and many more.

The Dotnet-Mammoth library proves to be a valuable asset for software developers who require robust and accurate document conversion capabilities within their .NET applications. It easily imports and publishes Word documents on websites or blogs while preserving their formatting. Its support for intricate styling, ease of use, and configurability sets it apart as a go-to choice for handling document transformations. By leveraging the power of the library, developers can unlock a world of possibilities in seamlessly converting complex documents while maintaining their visual and structural integrity.

Previous Next

Getting Started with Dotnet-Mammoth

The recommend way to install Dotnet-Mammoth is using NuGet. Please use the following command for a smooth installation.

Install Dotnet-Mammoth from NuGet

 Install-Package Mammoth
You can also download it directly from GitHub.

Word Documents Conversion to HTML via C#

The open source Dotnet-Mammoth library gives software developers the power to load and convert Microsoft Word DOCX Documents to clean and accurate HTML inside .NET applications. The library excels in handling Microsoft Word documents (both .docx and .doc formats), making it an ideal choice for applications that deal with a wide range of documentation. It boasts remarkable accuracy in converting documents. It meticulously translates not only the textual content but also various styling elements, such as headings, lists, tables, and even embedded images. The following example shows how easily can software developers load and convert Word document into HTML file format using C# commands.

How to Convert Word Document into HTML file via C# API?

using DotnetMammoth;

class Program
{
    static void Main(string[] args)
    {
        var converter = new DocumentConverter();
        var result = converter.ConvertToHtml("path/to/document.docx");
        
        Console.WriteLine(result.Value);
    }
}

Extract Text & Handling Complex Documents

The open source Dotnet-Mammoth library has provided complete support for handling complex documents inside C# applications. Some documents can be incredibly intricate, with complex formatting, tables, images, and more. The library tackles this complexity effectively, ensuring that even documents with intricate layouts are converted with precision. It is also very easy to extract the raw text of the document by using ExtractRawText. The following example shows how software developers can extract text from a Word .docx document inside .NET applications.

How to Extract the Raw Text of a Word Document inside C# Apps?

var converter = new DocumentConverter();
var result = converter.ExtractRawText("document.docx");
var html = result.Value; // The raw text
var warnings = result.Warnings; // Any warnings during conversion

Accuracy, Preservation & Custom Styling

One of the primary concerns when converting documents is maintaining the fidelity of the original content. The Dotnet-Mammoth library excels in this aspect, striving to preserve the formatting, styles, and structure of the source document as accurately as possible in the resulting HTML. The library offers the option to apply custom styling during the conversion process, ensuring that the resulting HTML aligns with the design standards of your application. This level of customization enhances the consistency of your content across different platforms.

 English