diff --git a/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page.sln b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page.sln new file mode 100644 index 00000000..87cf5c89 --- /dev/null +++ b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.37012.4 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove_Header_Footer_In_First_Page", "Remove_Header_Footer_In_First_Page\Remove_Header_Footer_In_First_Page.csproj", "{483F3104-524F-3271-2115-9588696A5761}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {483F3104-524F-3271-2115-9588696A5761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {483F3104-524F-3271-2115-9588696A5761}.Debug|Any CPU.Build.0 = Debug|Any CPU + {483F3104-524F-3271-2115-9588696A5761}.Release|Any CPU.ActiveCfg = Release|Any CPU + {483F3104-524F-3271-2115-9588696A5761}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {094F660C-E79B-495C-9E4B-9C2F1C607F91} + EndGlobalSection +EndGlobal diff --git a/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Data/Template.docx b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Data/Template.docx new file mode 100644 index 00000000..cfa828c9 Binary files /dev/null and b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Data/Template.docx differ diff --git a/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Output/.gitkeep b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Output/Result.docx b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Output/Result.docx new file mode 100644 index 00000000..2523fa32 Binary files /dev/null and b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Output/Result.docx differ diff --git a/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Program.cs b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Program.cs new file mode 100644 index 00000000..86550f27 --- /dev/null +++ b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Program.cs @@ -0,0 +1,29 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using System.IO; + +namespace Remove_Header_Footer_In_First_Page +{ + class Program + { + static void Main(string[] args) + { + //Creates a new Word document. + using (FileStream fileStreamPath = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + using (WordDocument document = new WordDocument(fileStreamPath, Syncfusion.DocIO.FormatType.Automatic)) + { + //Get the first section from the Word document + WSection section = document.Sections[0]; + //Set DifferentFirstPage as true for indicating different header and footer used on first page. + section.PageSetup.DifferentFirstPage = true; + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + //Save a Word document to the file stream. + document.Save(outputFileStream, Syncfusion.DocIO.FormatType.Docx); + } + } + } + } + } +} \ No newline at end of file diff --git a/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Remove_Header_Footer_In_First_Page.csproj b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Remove_Header_Footer_In_First_Page.csproj new file mode 100644 index 00000000..8ab0632b --- /dev/null +++ b/Sections/Remove_Header_Footer_In_First_Page/.NET/Remove_Header_Footer_In_First_Page/Remove_Header_Footer_In_First_Page.csproj @@ -0,0 +1,22 @@ + + + + Exe + net8.0 + Remove_Header_Footer_In_First_Page + + + + + + + + + Always + + + Always + + + +