.NET Word Examples
- Create Word Document
- Perform Mail Merge
- Manage Bookmarks
- Find and Replace Text
- Format Tables
- Split Word Documents
- Merge Multiple Word Documents
- Fill and Manage Form Fields
- Generate and Update Table of Contents
- Compare Word Documents
- Encrypt and Decrypt Documents with Password
- Convert Word Documents to PDF
- Convert Word Documents to Images
- Word-HTML Conversions
- Word-Markdown Conversions
- Word-Text Conversions
Markdown Conversions Using the Syncfusion .NET Word Library
The Syncfusion® .NET Word Library enables you to convert Word documents to Markdown and Markdown to Word documents in C# with just a few lines of code, without relying on Microsoft Word or interop dependencies.
Watch this video to learn how to convert Word files to Markdown and Markdown files to Word using the Syncfusion .NET Word Library.
Perform Markdown conversions using C#
Learn how to convert Markdown to Word documents and Word documents to Markdown programmatically using C# with the Syncfusion .NET Word Library. This guide demonstrates bidirectional conversion between Word and Markdown formats.
Step 1: Create a new project
Start by creating a new C# Console Application project.
Step 2: Install the NuGet package
Add the Syncfusion.DocIO.Net.Core package to your project from NuGet.org.
Step 3: Add required namespaces to perform Markdown conversion
Add the following namespaces to your Program.cs file:
using System.IO;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;Step 4: Open a Word document
Open an existing Word document from a file stream.
FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
//Load the file stream into a Word document
WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx);Step 5: Save as Markdown file
Convert and Save the Word document as a Markdown file.
//Create a file stream
FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.md"), FileMode.Create, FileAccess.ReadWrite);
//Save a Markdown file to the file stream
document.Save(outputFileStream, FormatType.Markdown);
document.Close();
fileStreamPath.Close();
outputFileStream.Close();Step 6: Open a Markdown file
Open an existing Markdown file and load it as a Word document.
FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.md"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
//Load the file stream into a Markdown file
WordDocument document = new WordDocument(fileStreamPath, FormatType.Markdown);Step 7: Save the Word document
Convert and save the Markdown content as a Word document.
//Create a file stream
FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/MarkdownToWord.docx"), FileMode.Create, FileAccess.ReadWrite);
//Save a Word document to the file stream
document.Save(outputFileStream, FormatType.Docx);
document.Close();
fileStreamPath.Close();
outputFileStream.Close();GitHub project
NuGet installation
Get started quickly by downloading the installer and checking license information on the Downloads page.
Table of contents
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Learning
Technical Support
