There is a specific hyperlink makes Aspose.Words failed to handle

Hi Aspose team,
We use Aspose.Words 17.8.0.0 to handle hyperlink in this file test.zip (15.6 KB)
and Aspose has failed to handle hyperlink
This is my sample code

         try
        {
            Aspose.Words.Document doc = new Aspose.Words.Document(inputFile);

            NodeCollection starts = doc.GetChildNodes(NodeType.FieldStart, true);

            foreach (FieldStart start in starts)
            {
                if (start.FieldType == Aspose.Words.Fields.FieldType.FieldHyperlink)
                {
                    Node currentNode = start.NextSibling;

                    while (currentNode.NodeType != NodeType.FieldEnd)
                    {
                        currentNode = currentNode.NextSibling;
                    }

                }
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }

Debug code, we saw that hyperlink has character ‘\r’ in the last position and this is the cause. Could you please check this issue?
And please double check with other special characters (\n, \t…)
Thanks

@kto

Thanks for your inquiry. We have tested the scenario and noticed the reported exception. We have logged a ticket WORDSNET-15829 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

@kto

Thanks for your patience. We have investigated the issue and noticed it is not a bug but expected behavior. Please save your document as DOCX then unzip and check document structure. Please see the attached imagescreen.png (65.8 KB)
. Please check the summary of NextSibling method “Gets the node immediately following this node. If there is no next node, a null is returned.”. So there is no next node so API is throwing expected exception. In your case you have to use NextPreOrder method. Hope, it will help.

Hi,
I can’t download or see the attached image. It says “Sorry, this file is private. Only visible to topic owner and staff members.”
And as i noticed, if we have a character like ‘\r’ in the end of hyperlink, Aspose will throw error and we can’t handle that hyperlink. Is this expected behavior? How can we handle these hyperlinks like that?

@kto

Thanks for your feedback. As stated above, in this case, you can use NextPreOrder as following instead of NextSibling. Furthermore please double check you have singed in properly in Aspose Website.screen.png (65.8 KB)

....
currentNode = currentNode.NextPreOrder(doc); 
....