Skip to content

Commit 06b99da

Browse files
author
Konduru Keerthi Konduru Ravichandra Raju
committed
Paragraphs
1 parent 3cb49d3 commit 06b99da

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove_all_page_breaks", "Remove_all_page_breaks\Remove_all_page_breaks.csproj", "{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {5AA2BDB5-3AE9-4E8D-8115-E0B1DF21850D}
24+
EndGlobalSection
25+
EndGlobal
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
4+
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read))
5+
{
6+
//Open the existing Word document.
7+
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
8+
{
9+
//Get the list of page breaks
10+
List<Entity> entities = document.FindAllItemsByProperty(EntityType.Break, "BreakType", "PageBreak");
11+
12+
//Iterate through all page breaks and remove it from the owner paragraph
13+
foreach (Entity entity in entities)
14+
(entity as Break).OwnerParagraph.ChildEntities.Remove(entity);
15+
16+
//Save the Word document
17+
using (FileStream outputStream = new FileStream(@"../../../Output.docx", FileMode.Create, FileAccess.Write))
18+
{
19+
document.Save(outputStream, FormatType.Docx);
20+
}
21+
}
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
12+
</ItemGroup>
13+
14+
</Project>

0 commit comments

Comments
 (0)