Skip to content

Commit ad8496d

Browse files
Added Word to Markdown Conversion with Preserved Word Elements Sample
1 parent 4c9ed69 commit ad8496d

5 files changed

Lines changed: 49 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="Convert-Word-to-Markdown-with-Word-Elements/Convert-Word-to-Markdown-with-Word-Elements.csproj" />
3+
</Solution>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<RootNamespace>Convert_Word_to_Markdown_with_Word_Elements</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
13+
</ItemGroup>
14+
<ItemGroup>
15+
<None Update="Data\Input.docx">
16+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
17+
</None>
18+
<None Update="Output\.gitkeep">
19+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20+
</None>
21+
</ItemGroup>
22+
23+
</Project>

‎Word-to-Markdown-conversion/Convert-Word-to-Markdown-with-Word-Elements/.NET/Convert-Word-to-Markdown-with-Word-Elements/Output/.gitkeep‎

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
using Syncfusion.DocIORenderer;
4+
using System.IO;
5+
6+
namespace Convert_Word_to_Markdown_with_Word_Elements
7+
{
8+
class Program
9+
{
10+
static void Main(string[] args)
11+
{
12+
//Open an existing Word document.
13+
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data/Input.docx")))
14+
{
15+
// Initialize the DocIORenderer to preserve Word elements as images.
16+
using DocIORenderer docIORenderer = new DocIORenderer();
17+
//Save the document as a Markdown file.
18+
document.Save(Path.GetFullPath(@"Output/Output.md"));
19+
}
20+
}
21+
}
22+
}
23+

0 commit comments

Comments
 (0)