This guide shows you how to convert documents to Markdown with GroupDocs.Markdown for .NET. You’ll have working code in under 2 minutes.
How it works
flowchart LR
A["Input Document\n(DOCX, PDF, XLSX, EPUB, ...)"]
B["MarkdownConverter"]
C["Markdown Output\n(.md file or string)"]
A --> B --> C
Prerequisites
Install the NuGet package:
dotnet add package GroupDocs.Markdown
Install-PackageGroupDocs.Markdown
Add the namespace:
usingGroupDocs.Markdown;
Example 1: Convert Word to Markdown
The simplest conversion — one line of code:
usingGroupDocs.Markdown;// Convert a Word document to Markdownstringmarkdown=MarkdownConverter.ToMarkdown("business-plan.docx");Console.WriteLine(markdown);// Or save directly to a fileMarkdownConverter.ToFile("business-plan.docx","business-plan.md");
business-plan.docx is a sample file used in this example. Click here to download it.
Example 2: Convert PDF with image export
Save a PDF to Markdown with images extracted to a folder:
usingGroupDocs.Markdown;varoptions=newConvertOptions{ImageExportStrategy=newExportImagesToFileSystemStrategy("output/images"){ImagesRelativePath="images"}};MarkdownConverter.ToFile("report.pdf","output/report.md",options);// Images saved to output/images/// Markdown references: 
report.pdf is a sample file used in this example. Click here to download it.
Example 3: Convert Excel with options
Convert a spreadsheet with column truncation and front matter:
usingGroupDocs.Markdown;varoptions=newConvertOptions{MaxColumns=8,MaxRows=50,IncludeFrontMatter=true,Flavor=MarkdownFlavor.GitHub};usingvarconverter=newMarkdownConverter("budget.xlsx");// Inspect before convertingDocumentInfoinfo=converter.GetDocumentInfo();Console.WriteLine($"Worksheets: {info.PageCount}");// ConvertConvertResultresult=converter.Convert(options);Console.WriteLine(result.Content);// Check warningsforeach(stringwinresult.Warnings)Console.WriteLine($"Warning: {w}");
budget.xlsx is a sample file used in this example. Click here to download it.