Free Support Forum -

How to get the file name of the subdocument node

After getting the subdocument node from the document

        Dim subdocuments As Aspose.Words.NodeCollection = asposeDoc.GetChildNodes(Aspose.Words.NodeType.SubDocument, True)
        Dim subDocumentNode As Aspose.Words.Node = subdocuments(0)

How can we parse the subDocumentNode to get the filename of the subdocument.



Please ZIP and attach your input Word document containing the SubDocument here for testing. We will then investigate the scenario on our end and provide you more information. (33.5 KB)

Please find the files attached.

Master.docx refers to the SubDocument.docx


I have found the answer

  Dim s = subDocumentNode.GetType().GetFields(BindingFlags.NonPublic Or BindingFlags.Instance)

  Dim file_name = s(0).GetValue(subDocumentNode)


It is great you were able to find what you were looking for. Please let us know any time you have any further queries.


Do you know of a way to get the entire subdocument path from the master document?
After we open the masterdocument.docx. There is a link to the subdocument like
C:/…/Subdocument.docx or \vm-41-adb-nr…\Subdocument.docx

Is there a way we can get the entire path not just the filename?

Please let me know


Thanks for your inquiry. We have logged your requirement in our issue tracking system. The ID of your issue is WORDSNET-16853. We will further look into the details of this requirement and will keep you updated on the status of this issue. We apologize for any inconvenience.


But, if you unzip the master document and check its XML, you will see the subdocument target is “SubDocument.docx” – only the name of the file. So, the full path would be the path of the master document location plus subdocument target. For example, if I copy both these test documents to desktop the path automatically changes and appears to me as follows:


So, we would not be able to implement the fix of this issue and we are planning to close this issue as won’t fix. If we can help you with anything else, please feel free to ask.


Thank you. what you have mentioned seems to be the problem.


Thanks for your understanding. In case you have any further queries or need any help, please let us know.