diff --git a/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak.sln b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak.sln new file mode 100644 index 00000000..4894b268 --- /dev/null +++ b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak.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}") = "Replace_New_Line_as_LineBreak", "Replace_New_Line_as_LineBreak\Replace_New_Line_as_LineBreak.csproj", "{EC349BC0-6493-5BBA-F4AF-16FD39A32A50}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EC349BC0-6493-5BBA-F4AF-16FD39A32A50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC349BC0-6493-5BBA-F4AF-16FD39A32A50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC349BC0-6493-5BBA-F4AF-16FD39A32A50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC349BC0-6493-5BBA-F4AF-16FD39A32A50}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {336109EE-9654-4B71-A238-B38EB152721D} + EndGlobalSection +EndGlobal diff --git a/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Output/.gitkeep b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Output/.gitkeep new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Output/Result.docx b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Output/Result.docx new file mode 100644 index 00000000..6210a104 Binary files /dev/null and b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Output/Result.docx differ diff --git a/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Program.cs b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Program.cs new file mode 100644 index 00000000..34906eb8 --- /dev/null +++ b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Program.cs @@ -0,0 +1,39 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; + +namespace Replace_New_Line_as_LineBreak +{ + class Program + { + static void Main(string[] args) + { + //Creates a new Word document. + using (WordDocument document = new WordDocument()) + { + //This method adds a section and a paragraph in the document. + document.EnsureMinimal(); + //Accessing the last paragraph. + IWParagraph paragraph = document.LastParagraph; + //Applying bullet style to the paragraph. + paragraph.ListFormat.ApplyDefBulletStyle(); + //Text to be added. + string completeText = "Adventure Works Cycles:\nAdventure Works Cycles, the fictitious company on which the Adventure Works sample databases are based, is a large, multinational manufacturing company.\n" + + "The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets."; + //Splitting the text based on new line character. + string[] textArray = completeText.Split('\n'); + //Adding the splitted text in the paragraph by inserting the LineBreak instead of new line character. + foreach (string text in textArray) + { + paragraph.AppendText(text); + paragraph.AppendBreak(BreakType.LineBreak); + } + //Saving the document. + using (FileStream outputStream = new FileStream(@"../../../Output/Result.docx", FileMode.OpenOrCreate)) + { + document.Save(outputStream, FormatType.Docx); + } + } + } + } +} + \ No newline at end of file diff --git a/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak.csproj b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak.csproj new file mode 100644 index 00000000..b613b091 --- /dev/null +++ b/Paragraphs/Replace_New_Line_as_LineBreak/.NET/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak/Replace_New_Line_as_LineBreak.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + Replace_New_Line_as_LineBreak + enable + enable + + + + + + + + + Always + + +