Working with Pages
Get Number of Pages from the OneNote Document
Aspose.Note for Java supports retrieving number of pages from a OneNote document.
This example work as follows:
- Create an object of the Document class.
- Call Document class’ getChildNodes method.
- Get a list of page nodes.
- Get the number of pages via Count property.
- Display the count on the output screen.
The following code snippet shows you how to get the number of pages from a OneNote file
Get Information of Each Page from the OneNote Document
The code below shows how to get information about each page in a OneNote document.
Create OneNote Document with Root and Sub Level Pages
This article explains how developers can generate OneNote document including various pages at root or sub-level positions. Aspose.Note APIs lets the developer to programmatically choose the level of the page.
Generating Root and Sub Level Pages in OneNote
Please see brief description to create a OneNote document using the Aspose.Note APIs:
- Create an instance of the Document class that represents a OneNote document.
- Initialize three objects of Page class and set their levels.
- Initialize separate objects of Outline, OutlineElement and RichText classes for each Page object by passing the Document class object. Calling the AppendChildLast method of the OutlineElement, Outline, Page and Document classes adds an appropriate new node that can be further used to add other nodes to the OneNote document.
- The TextStyle class defines the text formatting.
- Generate the OneNote document by calling the Save method of the Document object.
Working with Page Revision Information
Working with Page History
Get All Revisions of a Specific Page
There is a LoadHistory property of the LoadOptions class which tells whether the document loader should read and parse entire document history. The default value is true. In case of file with huge amount of history data consider using LoadHistory=false, to decrease memory and CPU usage.
The code sample below shows how to get a particular Page and then get its history revisions detail.
Roll Back To Previous Page Version
Push Current Page Version To History
Modify Page History
Working with Conflict Pages
A document can have pages with conflict pages in its history. Such pages are not saved to document by default. Aspose.Note API lets you manipulate such a page history using the isConflictPage method of history page as shown below.