diff --git a/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField.slnx b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField.slnx
new file mode 100644
index 00000000..76465325
--- /dev/null
+++ b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField.slnx
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Data/Input.docx b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Data/Input.docx
new file mode 100644
index 00000000..5a959c4a
Binary files /dev/null and b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Data/Input.docx differ
diff --git a/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Output/.gitkeep b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Output/.gitkeep
new file mode 100644
index 00000000..5f282702
--- /dev/null
+++ b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Output/.gitkeep
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Output/Output.docx b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Output/Output.docx
new file mode 100644
index 00000000..ca1b04af
Binary files /dev/null and b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Output/Output.docx differ
diff --git a/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Program.cs b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Program.cs
new file mode 100644
index 00000000..86a34733
--- /dev/null
+++ b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Program.cs
@@ -0,0 +1,58 @@
+using Syncfusion.DocIO;
+using Syncfusion.DocIO.DLS;
+
+namespace Remove_InlineContentControls_Containing_PageField
+{
+ class Program
+ {
+ public static void Main(string[] args)
+ {
+ //Load existing Word document
+ using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data/Input.docx"), FormatType.Docx))
+ {
+ //Find Content control
+ List entities = document.FindAllItemsByProperties(EntityType.InlineContentControl, null, null);
+ // Iterate through the list of entities in reverse to safely remove items during iteration
+ for (int i = entities.Count - 1; i >= 0; i--)
+ {
+ // Attempt to cast the current entity to an InlineContentControl
+ InlineContentControl inLineContentControl = entities[i] as InlineContentControl;
+ if (inLineContentControl != null)
+ {
+ // Iterate through the child items of the content control
+ foreach (ParagraphItem entity in inLineContentControl.ParagraphItems)
+ {
+ // Check if the entity is a PAGE field
+ if (entity is WField field && field.FieldType == FieldType.FieldPage)
+ {
+ // If the content control is nested inside another content control
+ if (inLineContentControl.Owner is InlineContentControl)
+ {
+ InlineContentControl owner = inLineContentControl.Owner as InlineContentControl;
+ // Remove the current content control from its parent content control
+ owner.ParagraphItems.Remove(inLineContentControl);
+ }
+ // If the content control is directly inside a paragraph
+ else if (inLineContentControl.Owner is WParagraph)
+ {
+ WParagraph parentParagraph = inLineContentControl.Owner as WParagraph;
+ // Remove the content control from the paragraph
+ parentParagraph.ChildEntities.Remove(inLineContentControl);
+ }
+ // Remove the content control from the main entity list
+ entities.RemoveAt(i);
+ // Exit the inner loop since the control has been removed
+ break;
+ }
+ }
+ }
+ }
+ // Save the document if needed
+ using (FileStream fileStream = new FileStream(@"../../../Output/Output.docx", FileMode.OpenOrCreate, FileAccess.ReadWrite))
+ {
+ document.Save(fileStream, FormatType.Docx);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Remove-InlineContentControls-Containing-PageField.csproj b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Remove-InlineContentControls-Containing-PageField.csproj
new file mode 100644
index 00000000..372bd03d
--- /dev/null
+++ b/Content-Controls/Remove-InlineContentControls-Containing-PageField/.NET/Remove-InlineContentControls-Containing-PageField/Remove-InlineContentControls-Containing-PageField.csproj
@@ -0,0 +1,21 @@
+
+
+
+ Exe
+ net8.0
+ Remove_InlineContentControls_Containing_PageField
+ enable
+ enable
+
+
+
+
+
+
+
+
+ Always
+
+
+
+