Were trying to go through OneNote documents and extract their text and sub documents. Below is a piece of code were using to iterate over these but we don’t seem to be getting all attachments.
This is just sudocode showing the api’s were using.
for (Page page: getDocument().getChildren()) { for (IPageChildNode childNode: page.getChildren()) { if (childNode instanceof Image) { data = ((Image)childNode).getBytes(); } else if (childNode instanceof AttachedFile) { data = ((AttachedFile)childNode).getBytes(); } else if (childNode instanceof Outline) { // Ignore these, we get their text elsewhere. return null; } else { throw new UnsupportedOperationException(“Unknown chileNode type”); } } }
We would expect to see the following items, but we only see “Form I-9.pdf”, and “Donald Semelsberger - Memorial Service Program.docx”. Am I doing something wrong and need to use the API differently?
I have tested this with the following sample code and it lists all the children of a page without any issue. Please try it at your end and let us know your feedback if you face any issue.
Sample Code
Document oneFile = new Document(“829895\Helen’s OneNote with XLS email attachment.one”);
List pages = oneFile.getChildNodes(Page.class);
System.out.println(pages.size());
for(Page page:pages) {
// Get list of attachments
List attachments = page.getChildNodes(AttachedFile.class);
We have come across a sample document that we don’t seem to be getting any pages from even though it has one. I’ve been using the code suggested above and we get nothing.
Can you take a look at the file and see if you can see anything.
We were able to reproduce the issue at our end with the available version of Aspose.Note for Java and have logged it as NOTEJAVA-250 for further investigation by our Product team. We’ll update you here once there is some information or a fix version available in this regard.
The issues you have found earlier (filed as NOTEJAVA-250) have been fixed in Aspose.Note for Java v19.11. This message was posted using Bugs notification tool by ahsaniqbalsidiqui