diff --git a/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts.sln b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts.sln new file mode 100644 index 00000000..e747af12 --- /dev/null +++ b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.37314.3 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Change_Font_Size_For_Highlighted_Texts", "Change_Font_Size_For_Highlighted_Texts\Change_Font_Size_For_Highlighted_Texts.csproj", "{F67A30EB-8D8F-454D-47D1-40582F91AFC3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F67A30EB-8D8F-454D-47D1-40582F91AFC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F67A30EB-8D8F-454D-47D1-40582F91AFC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F67A30EB-8D8F-454D-47D1-40582F91AFC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F67A30EB-8D8F-454D-47D1-40582F91AFC3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {18366B0B-7231-4300-AD29-B24C1FAB9785} + EndGlobalSection +EndGlobal diff --git a/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Change_Font_Size_For_Highlighted_Texts.csproj b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Change_Font_Size_For_Highlighted_Texts.csproj new file mode 100644 index 00000000..8d46b05c --- /dev/null +++ b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Change_Font_Size_For_Highlighted_Texts.csproj @@ -0,0 +1,23 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Data/Template.docx b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Data/Template.docx new file mode 100644 index 00000000..20286e7b Binary files /dev/null and b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Data/Template.docx differ diff --git a/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Output/Result.docx b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Output/Result.docx new file mode 100644 index 00000000..4cee1d3a Binary files /dev/null and b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Output/Result.docx differ diff --git a/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Output/gitkeep.txt b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Output/gitkeep.txt new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Output/gitkeep.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Program.cs b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Program.cs new file mode 100644 index 00000000..4981dce2 --- /dev/null +++ b/Paragraphs/Change_Font_Size_For_Highlighted_Texts/.NET/Change_Font_Size_For_Highlighted_Texts/Program.cs @@ -0,0 +1,38 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; + +namespace Change_Font_Size_For_Highlighted_Texts +{ + class Program + { + static void Main(string[] args) + { + using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + //Opens an existing document. + using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx)) + { + // Finds all the text ranges in the document which have highlight color. + List entities = document.FindAllItemsByProperty(EntityType.TextRange, "CharacterFormat.HighlightColor.IsEmpty", false.ToString()); + + // Iterates the text ranges. + foreach (Entity entity in entities) + { + // Casts the entity as WTextRange. + WTextRange textRange = entity as WTextRange; + // Get character format of the text + WCharacterFormat charFormat = textRange.CharacterFormat; + // Set text's font size larger + charFormat.FontSize = 14; + } + //Creates file stream. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + //Saves the Word document to file stream. + document.Save(outputFileStream, FormatType.Docx); + } + } + } + } + } +}