Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Apply_Character_Formats_To_TextRange_From_ParagraphStyle</RootNamespace>
</PropertyGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>



</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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"));
}
}
}
}
Loading