We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Code from sample results in System.NullReferenceException

Hello,

I’m trialing the Aspose.Note functionality. Using the code straight from the documentation for VB.NET, results in the exception shown in the screenshot here(and attached below)

In the code below (a screenshot is also attached) the line that produced the error starts “Dim oneFile as New Document(…”. The OneNote document being referenced is formatted 2010-2013. Permissions on the folder containing the “passwords.one” file are “everyone= full control”.

Can you advise on what may be causing this condition?

Imports Aspose.Note
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim oneFile As New Document(“C:\shared\sample_one_note_for_indexing_test\passwords.one”)
Dim nodes As IList = oneFile.GetChildNodes(NodeType.Page)
If nodes.Count > 0 AndAlso nodes(0).NodeType = NodeType.Page Then
Dim page As Page = DirectCast(nodes(0), Page)
Dim text As String = page.GetText()
TextBox2.Text = text
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class

Hi Terry,


Thank you for sharing the problematic OneNote document. Please download and use the latest Hotfix version Aspose.Note for .NET (Latest Version). It works perfect with your sample OneNote document.

Thank you, that works!