diff --git a/ooxml/XWPF/Usermodel/XWPFFootnotes.cs b/ooxml/XWPF/Usermodel/XWPFFootnotes.cs index b4fcc3237..e6dff9bb9 100644 --- a/ooxml/XWPF/Usermodel/XWPFFootnotes.cs +++ b/ooxml/XWPF/Usermodel/XWPFFootnotes.cs @@ -235,7 +235,12 @@ public XWPFDocument GetXWPFDocument() } else { - return (XWPFDocument)GetParent(); + var parent = GetParent(); + while(parent!=null && parent is not XWPFDocument) + { + parent=parent.GetParent(); + } + return parent as XWPFDocument; } }