These days, a large number of articles, blogs, and documentation are written in Markdown format. However, the Markdown syntax often becomes difficult to remember and write for large-sized documents. To make things easier, you can write content in MS Word and then convert DOCX or DOC document to Markdown. To automate Word to Markdown conversion, this article covers how to convert Word DOC DOCX to Markdown in C#.
- C# DOC DOCX to Markdown Converter - Free Download
- Convert a Word DOC to Markdown
- Customize DOCX to Markdown Conversion
C# Word DOC DOCX to Markdown Converter - Free Download
Aspose.Words for .NET is designed to create and manipulate Word documents from within .NET applications. In addition, it provides a built-in converter to convert MS Word documents to other formats. We will use this API to convert Word documents to Markdown format. You can download the API’s DLL or install it from NuGet using the package manager console.
PM> Install-Package Aspose.Words
Convert a Word Document to Markdown in C#
The following are the steps to convert a Word DOCX file to Markdown in C#.
- Load the Word file using Document class.
- Convert Word file to Markdown format using Document.Save(string) method.
The following code sample shows how to convert a DOCX file to Markdown format in C#.
C# Customize DOC to Markdown Conversion
You can also customize the default behavior of Word DOC/DOCX to Markdown conversion using different options. For example, you can set the alignment of the content in the tables, specify a folder to keep images, and so on. The following are the steps to customize Word DOC to Markdown conversion.
- Load the Word document using Document class.
- Create an object of MarkdownSaveOptions class.
- Set desired options such as MarkdownSaveOptions.ImagesFolder.
- Convert Word document to Markdown using Document.Save(string, MarkdownSaveOptions) method.
The following code sample shows how to customize DOCX to Markdown conversion in C#.
C# DOCX to Markdown Converter - Get a Free License
You can use Aspose.Words for .NET without evaluation limitations using a temporary license.
In this article, you have learned how to convert Word DOCX/DOC to Markdown in C#. Moreover, you have seen how to customize C# DOC to Markdown conversion using different options. You can also explore other features offered by Aspose.Words for .NET using the documentation. Also, you can feel free to ask your questions via our forum.