com.aspose.note

Class Document

    • Constructor Detail

      • Document

        public Document()

        Initializes a new instance of the Document class. Creates a blank OneNote document.

      • Document

        public Document(String filePath)

        Initializes a new instance of the Document class. Opens an existing OneNote document from a file.

        Parameters:
        filePath - The file path.
        Throws:
        UnsupportedFileFormatException - The document format is not recognized or not supported.
        FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        IncorrectPasswordException - The document is encrypted and requires a password to open, but you supplied an incorrect password.
        com.aspose.ms.System.InvalidOperationException - There is a problem with the document and it should be reported to Aspose.Note developers.
        IOException - There is an input/output exception.
      • Document

        public Document(String filePath,
                        LoadOptions loadOptions)

        Initializes a new instance of the Document class. Opens an existing OneNote document from a file. Allows to specify additional options such as an encryption password.

        Parameters:
        filePath - The file path.
        loadOptions - Options used to load a document. Can be null.
        Throws:
        UnsupportedFileFormatException - The document format is not recognized or not supported.
        FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        IncorrectPasswordException - The document is encrypted and requires a password to open, but you supplied an incorrect password.
        com.aspose.ms.System.InvalidOperationException - There is a problem with the document and it should be reported to Aspose.Note developers.
        IOException - There is an input/output exception.
      • Document

        public Document(InputStream inStream)

        Initializes a new instance of the Document class. Opens an existing OneNote document from a stream.

        Parameters:
        inStream - The stream.
        Throws:
        UnsupportedFileFormatException - The document format is not recognized or not supported.
        FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        IncorrectPasswordException - The document is encrypted and requires a password to open, but you supplied an incorrect password.
        com.aspose.ms.System.InvalidOperationException - There is a problem with the document and it should be reported to Aspose.Note developers.
        IOException - There is an input/output exception.
        com.aspose.ms.System.ArgumentException - The stream does not support reading, is null, or is already closed.
      • Document

        public Document(InputStream inStream,
                        LoadOptions loadOptions)

        Initializes a new instance of the Document class. Opens an existing OneNote document from a stream. Allows to specify additional options such as an encryption password.

        Parameters:
        inStream - The stream.
        loadOptions - Options used to load a document. Can be null.
        Throws:
        UnsupportedFileFormatException - The document format is not recognized or not supported.
        FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        IncorrectPasswordException - The document is encrypted and requires a password to open, but you supplied an incorrect password.
        com.aspose.ms.System.InvalidOperationException - There is a problem with the document and it should be reported to Aspose.Note developers.
        IOException - There is an input/output exception.
        com.aspose.ms.System.ArgumentException - The stream does not support reading, is null, or is already closed.
    • Method Detail

      • getAutomaticLayoutChangesDetectionEnabled

        public boolean getAutomaticLayoutChangesDetectionEnabled()

        Gets or sets a value indicating whether Aspose.Note performs detection of layout changes automatically. Default value is true.

      • setAutomaticLayoutChangesDetectionEnabled

        public void setAutomaticLayoutChangesDetectionEnabled(boolean value)

        Gets or sets a value indicating whether Aspose.Note performs detection of layout changes automatically. Default value is true.

      • getCreationTime

        public Date getCreationTime()

        Gets or sets the creation time.

      • setCreationTime

        public void setCreationTime(Date value)

        Gets or sets the creation time.

      • setColor

        public void setColor(Color value)

        Gets or sets the color.

      • setDisplayName

        public void setDisplayName(String value)

        Gets or sets the display name.

      • getFileFormat

        public int getFileFormat()

        Gets file format (OneNote 2010, OneNote Online).

      • accept

        public void accept(DocumentVisitor visitor)

        Accepts the visitor of the node.

        Specified by:
        accept in interface INode
        Overrides:
        accept in class CompositeNode<Page>
        Parameters:
        visitor - The object of a class derived from the DocumentVisitor.
      • getPageHistory

        public PageHistory getPageHistory(Page page)

        Gets the PageHistory which contains full history for each page presented in a document (the earliest at index 0). The current page revision can be accessed as PageHistory.Current and contained separately from collection of historical versions.

        Parameters:
        page - The current revision of a page.
        Returns:
        The PageHistory.
      • save

        public void save(String fileName,
                         int format)
                  throws IOException

        Saves the OneNote document to a file in the specified format.

        Parameters:
        fileName - The full name for the file. If a file with the specified full name already exists, the existing file is overwritten.
        format - The format in which to save the document.
        Throws:
        IncorrectDocumentStructureException - The document structure violates specification.
        UnsupportedSaveFormatException - Requested save format is not supported.
        IOException
      • save

        public void save(String fileName,
                         SaveOptions options)
                  throws IOException

        Saves the OneNote document to a file using the specified save options.

        Parameters:
        fileName - The full name for the file. If a file with the specified full name already exists, the existing file is overwritten.
        options - Specifies the options how the document is saved in file.
        Throws:
        IncorrectDocumentStructureException - The document structure violates specification.
        UnsupportedSaveFormatException - Requested save format is not supported.
        IOException
      • detectLayoutChanges

        public void detectLayoutChanges()

        Detects all changes made to the document layout since the previous DetectLayoutChanges call. In case AutomaticLayoutChangesDetectionEnabled set to true, used automatically in the beginning of document export.