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.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
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

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

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

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

</Project>
Loading