Docx to Md

Convert Word Documents to Markdown

Use GroupDocs.Markdown to convert DOCX and other Word documents to clean Markdown.

Using static method

The simplest way to convert a Word file:

using GroupDocs.Markdown;

// Set license (optional)
License.Set("GroupDocs.Markdown.lic");

// Convert DOCX to Markdown string
string markdown = MarkdownConverter.ToMarkdown("report.docx");

// Or save directly to a file
MarkdownConverter.ToFile("report.docx", "report.md");

Using instance API with options

For more control, use the instance API:

using GroupDocs.Markdown;

License.Set("GroupDocs.Markdown.lic");

using var converter = new MarkdownConverter("report.docx");
var options = new ConvertOptions
{
    ImageExportStrategy = new ExportImagesToFileSystemStrategy("images")
    {
        ImagesRelativePath = "images"
    },
    HeadingLevelOffset = 1
};

ConvertResult result = converter.Convert(options);
Console.WriteLine(result.Content);

For the full list of input formats, see the supported formats page.