diff --git a/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle.sln b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle.sln new file mode 100644 index 00000000..ac468dd9 --- /dev/null +++ b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.37614.0 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apply_Character_Formats_To_TextRange_From_ParagraphStyle", "Apply_Character_Formats_To_TextRange_From_ParagraphStyle\Apply_Character_Formats_To_TextRange_From_ParagraphStyle.csproj", "{D486A5AD-4E3C-09E0-2CCF-3CBAE3A79491}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D486A5AD-4E3C-09E0-2CCF-3CBAE3A79491}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D486A5AD-4E3C-09E0-2CCF-3CBAE3A79491}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D486A5AD-4E3C-09E0-2CCF-3CBAE3A79491}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D486A5AD-4E3C-09E0-2CCF-3CBAE3A79491}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {74320268-A919-4385-902F-58D07EE4438D} + EndGlobalSection +EndGlobal diff --git a/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Apply_Character_Formats_To_TextRange_From_ParagraphStyle.csproj b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Apply_Character_Formats_To_TextRange_From_ParagraphStyle.csproj new file mode 100644 index 00000000..19289d71 --- /dev/null +++ b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Apply_Character_Formats_To_TextRange_From_ParagraphStyle.csproj @@ -0,0 +1,24 @@ + + + + Exe + net8.0 + Apply_Character_Formats_To_TextRange_From_ParagraphStyle + + + + + Always + + + Always + + + + + + + + + + diff --git a/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Data/Template.docx b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Data/Template.docx new file mode 100644 index 00000000..56136231 Binary files /dev/null and b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Data/Template.docx differ diff --git a/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Output/.gitkeep b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Output/.gitkeep new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Output/Result.docx b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Output/Result.docx new file mode 100644 index 00000000..142409b5 Binary files /dev/null and b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Output/Result.docx differ diff --git a/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Program.cs b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Program.cs new file mode 100644 index 00000000..08eac684 --- /dev/null +++ b/Paragraphs/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/.NET/Apply_Character_Formats_To_TextRange_From_ParagraphStyle/Program.cs @@ -0,0 +1,28 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using System.IO; + +namespace Apply_Character_Formats_To_TextRange_From_ParagraphStyle +{ + class Program + { + static void Main(string[] args) + { + + //Opens an existing Word document. + using (WordDocument document = new WordDocument(Path.GetFullPath("Data/Template.docx"))) + { + //Adds a paragraph to last section. + WParagraph paragraph = document.LastSection.AddParagraph() as WParagraph; + //Appends the text. + WTextRange textRange = paragraph.AppendText("The company continues to expand its market reach through innovation, efficient manufacturing processes, and a strong global distribution network.") as WTextRange; + //Get the style in the Word document. + WParagraphStyle paragraphStyle = document.Styles.FindByName("PalabraParagraph") as WParagraphStyle; + //Apply character formats from paragraph style. + textRange.ApplyCharacterFormat(paragraphStyle.CharacterFormat); + //Saves and closes the Word document. + document.Save(Path.GetFullPath("Output/Result.docx")); + } + } + } +}