-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cb49d3
commit 06b99da
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Paragraphs/Remove_all_page_breaks/.NET/Remove_all_page_breaks.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.10.34928.147 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove_all_page_breaks", "Remove_all_page_breaks\Remove_all_page_breaks.csproj", "{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BBAF7F96-C858-4CE2-AEA5-5192110B8CB8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5AA2BDB5-3AE9-4E8D-8115-E0B1DF21850D} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+20.2 KB
Paragraphs/Remove_all_page_breaks/.NET/Remove_all_page_breaks/Data/Template.docx
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
Paragraphs/Remove_all_page_breaks/.NET/Remove_all_page_breaks/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Syncfusion.DocIO; | ||
using Syncfusion.DocIO.DLS; | ||
|
||
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read)) | ||
{ | ||
//Open the existing Word document. | ||
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx)) | ||
{ | ||
//Get the list of page breaks | ||
List<Entity> entities = document.FindAllItemsByProperty(EntityType.Break, "BreakType", "PageBreak"); | ||
|
||
//Iterate through all page breaks and remove it from the owner paragraph | ||
foreach (Entity entity in entities) | ||
(entity as Break).OwnerParagraph.ChildEntities.Remove(entity); | ||
|
||
//Save the Word document | ||
using (FileStream outputStream = new FileStream(@"../../../Output.docx", FileMode.Create, FileAccess.Write)) | ||
{ | ||
document.Save(outputStream, FormatType.Docx); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Paragraphs/Remove_all_page_breaks/.NET/Remove_all_page_breaks/Remove_all_page_breaks.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |