Word Extract Content Code not working properly

Hi
Please see attached code that was given to me from an Aspose support engineer.
It’s been working fine, but for one word document that I am extracting content from breaks the code.

The code that breaks is highlighted in the attachment in YELLOW.
I have reproduced here for your convenience:

if ((currNode.NextSibling == null) && (isExtracting))
{
    // Move to the next section.
    Section nextSection = (Section)currNode.GetAncestor(NodeType.Section).NextSibling;
    currNode = nextSection.Body.FirstChild;
}
else
{
    // Move to the next node in the body.
    currNode = currNode.NextSibling;
}

the nextSection object is sometimes returned as NULL and so the next line of code breaks.

can you provide the code for the ELSE condition when nextSection is NULL.

Hi Nitin,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please

create a standalone/runnable simple application (for example a Console
Application Project
) that demonstrates the code (Aspose.Words code) you used to generate
your output document

  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.