Create OneNote Files Programmatically using Java

Create OneNote file

OneNote files are used to keep the information organized as digital notes. You can create OneNote files from scratch using Java. In this article, you will explore different features like adding text, pages, or tags in .One files:

OneNote Document Creator – Java API Installation

Aspose.Note for Java API supports creating, editing, or manipulating OneNote files. You can easily make some API calls and the output file is generated as per your requirements. Please download the JAR file from the Downloads section, or use the following configuration in your Maven-based projects:

Repository

 <repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <name>Aspose Java API</name>
        <url>https://repository.aspose.com/repo/</url>
    </repository>
</repositories>

Dependency

 <dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-note</artifactId>
        <version>21.7</version>
        <classifier>jdk17</classifier>        
    </dependency>
</dependencies>

Create OneNote Document with Simple Rich Text Programmatically using Java

You can create a OneNote document with simple rich text with the following steps:

  1. Create an object of the Document class.
  2. Initialize Page and Outline class objects.
  3. Add RichText node.
  4. Save output OneNote document.

The following code shows how to create a OneNote document with simple rich text using Java:

Create OneNote Document with Formatted Rich Text Programmatically using Java

Moving another step further, you can learn how to create a OneNote file with formatted rich text using Java:

  1. Create an object of the Document class.
  2. Initialize Page and TextStyle class objects.
  3. Format and add RichText node.
  4.  Save output OneNote file.

The code below explains how to create a OneNote document with formatted rich text using Java:

Insert Pages in OneNote File Programmatically with Java

You can insert roots as well as sub-level pages in the OneNote document with the below steps:

  1. Initialize an instance of the Document class.
  2. Insert 3 pages while specifying their levels.
  3. Add nodes to the pages and insert pages in the OneNote document.
  4. Finally, save output OneNote document.

The code below elaborates how to insert pages in the OneNote file with Java:

Add Tags in OneNote Files in Java

You can tag the contents in OneNote files. The following steps explain how to add a text node with a tag:

  1. Create an object of the Document class.
  2. Add RichText and Initialize NoteTag class object.
  3. Save output OneNote file.

The following code shows how to add tags in the OneNote file using Java:

Get Free API License

You can request a Free Temporary License for evaluating the API in its full capacity.

Conclusion

In this article, you have learned how to create OneNote files from scratch programmatically using Java. It covers all the details for inserting pages, adding rich text with a simple or formatted appearance in .One file. Moreover, you can check several other features by visiting the Documentation. Furthermore, please feel free to contact us at the Free Support Forum for any inquiries.

See Also

Convert OneNote File to Image Programmatically using Java