Skip to content

Commit eec710b

Browse files
Merge pull request #196 from SyncfusionExamples/Word_Samples
DocIO Samples
2 parents 8afd80a + 9cea28e commit eec710b

File tree

16 files changed

+261
-0
lines changed

16 files changed

+261
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extract-comments", "Extract-comments\Extract-comments.csproj", "{79D8C804-0EF9-4BF8-8390-639A737A0D42}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{79D8C804-0EF9-4BF8-8390-639A737A0D42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{79D8C804-0EF9-4BF8-8390-639A737A0D42}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{79D8C804-0EF9-4BF8-8390-639A737A0D42}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{79D8C804-0EF9-4BF8-8390-639A737A0D42}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {08816482-E634-492E-8D98-11456B2079EC}
24+
EndGlobalSection
25+
EndGlobal
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Extract_comments</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+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Syncfusion.DocIO.DLS;
2+
using Syncfusion.DocIO;
3+
4+
//Open an existing document
5+
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read))
6+
{
7+
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
8+
{
9+
//Iterate through the comments in the Word document
10+
foreach (WComment comment in document.Comments)
11+
{
12+
//Traverse each paragraph from the comment body items
13+
foreach (WParagraph paragraph in comment.TextBody.Paragraphs)
14+
Console.WriteLine(paragraph.Text);
15+
}
16+
}
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Find-and-change-font-for-text", "Find-and-change-font-for-text\Find-and-change-font-for-text.csproj", "{DFE9F723-DACC-49B2-8617-03E56AB788D7}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{DFE9F723-DACC-49B2-8617-03E56AB788D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{DFE9F723-DACC-49B2-8617-03E56AB788D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{DFE9F723-DACC-49B2-8617-03E56AB788D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{DFE9F723-DACC-49B2-8617-03E56AB788D7}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B0656087-A267-4AB1-8BC3-687BE238A563}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Find_and_change_font_for_text</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+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Syncfusion.DocIO.DLS;
2+
using Syncfusion.DocIO;
3+
4+
//Open an existing document
5+
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read))
6+
{
7+
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
8+
{
9+
//Find all instances of the target word in the document
10+
TextSelection[] textSelections = document.FindAll("Barcode", false, true);
11+
12+
foreach (TextSelection selection in textSelections)
13+
{
14+
//Apply the barcode font style
15+
selection.GetAsOneRange().CharacterFormat.FontName = "Code 128";
16+
}
17+
18+
//Save the Word document
19+
using (FileStream outputStream = new FileStream(@"../../../Output.docx", FileMode.Create, FileAccess.Write))
20+
{
21+
document.Save(outputStream, FormatType.Docx);
22+
}
23+
}
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove-headers-footers-in-section", "Remove-headers-footers-in-section\Remove-headers-footers-in-section.csproj", "{A04CC236-7FAF-49D9-ACBD-F0C4BFBFD137}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A04CC236-7FAF-49D9-ACBD-F0C4BFBFD137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A04CC236-7FAF-49D9-ACBD-F0C4BFBFD137}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A04CC236-7FAF-49D9-ACBD-F0C4BFBFD137}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A04CC236-7FAF-49D9-ACBD-F0C4BFBFD137}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {8B6C3119-165C-4D36-B570-D2A7C0ABCF23}
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)