We sometimes add ExtendedParts to the document for future use. I found it is very easy to access these parts using Open Xml SDK by runnin the following code:
var wDoc = WordprocessingDocument.Open(@"extendeddata.docx", true); var extendedParts = wDoc.GetPartsOfType<ExtendedPart>().ToList(); var stream = extendedParts.GetStream(); var id = wDoc.GetIdOfPart(extendedParts); var fileStream = File.Create(id + ".txt"); stream.Seek(0, SeekOrigin.Begin); stream.CopyTo(fileStream); fileStream.Close(); stream.Close();
Then I could have the external data (in my example it’s a .txt file embedded in the document) extracted with id on its name.
However I didn’t find the equivalent in Aspose.Words. Could you please advise what is the best approach to access this external data file using Aspose?
I’ve attached the docx and the expected output for your reference.
extendeddata.zip (9.0 KB)