Skip to content

Commit 02a188e

Browse files
Merge pull request #518 from SyncfusionExamples/1007016-WordML_sample
1007016- Added DocIO Sample for WordML Conversion
2 parents 05ab484 + a1b38b4 commit 02a188e

File tree

12 files changed

+115
-0
lines changed

12 files changed

+115
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="Convert-Word-to-WordML/Convert-Word-to-WordML.csproj" />
3+
</Solution>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Convert_Word_to_WordML</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Template.docx">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


WordML-conversion/Convert-Word-to-WordML/.NET/Convert-Word-to-WordML/Output/Result.xml

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
4+
namespace Convert_Word_to_WordML
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
//Loads an existing Word document into DocIO instance
11+
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
12+
{
13+
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
14+
{
15+
//Creates file stream
16+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.xml"), FileMode.Create, FileAccess.ReadWrite))
17+
{
18+
//Save the loaded document in WordML format to the output stream
19+
document.Save(outputFileStream, FormatType.WordML);
20+
//Closes the Word document
21+
document.Close();
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="Convert-WordML-to-Word/Convert-WordML-to-Word.csproj" />
3+
</Solution>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Convert_WordML_to_Word</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Input.xml">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>

WordML-conversion/Convert-WordML-to-Word/.NET/Convert-WordML-to-Word/Data/Input.xml

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


0 commit comments

Comments
 (0)