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:
        com.aspose.note.infrastructure.UnsupportedFileFormatException - The document format is not recognized or not supported.
        com.aspose.note.infrastructure.FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        com.aspose.note.infrastructure.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:
        com.aspose.note.infrastructure.UnsupportedFileFormatException - The document format is not recognized or not supported.
        com.aspose.note.infrastructure.FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        com.aspose.note.infrastructure.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:
        com.aspose.note.infrastructure.UnsupportedFileFormatException - The document format is not recognized or not supported.
        com.aspose.note.infrastructure.FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        com.aspose.note.infrastructure.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:
        com.aspose.note.infrastructure.UnsupportedFileFormatException - The document format is not recognized or not supported.
        com.aspose.note.infrastructure.FileCorruptedException - The document appears to be corrupted and cannot be loaded.
        com.aspose.note.infrastructure.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 a value indicating whether Aspose.Note performs detection of layout changes automatically. Default value is true.

      • setAutomaticLayoutChangesDetectionEnabled

        public void setAutomaticLayoutChangesDetectionEnabled(boolean value)

        Sets a value indicating whether Aspose.Note performs detection of layout changes automatically.

        Parameters:
        value - New value. Can be null.
      • getCreationTime

        public Date getCreationTime()

        Gets the creation time.

      • setCreationTime

        public void setCreationTime(Date value)

        Sets the creation time.

        Parameters:
        value - DateTime's value.
      • setColor

        public void setColor(Color value)

        Sets the color.

        Parameters:
        value - Color's value.
      • setDisplayName

        public void setDisplayName(String value)

        Sets the display name.

        Parameters:
        value - DateTime's value.
      • 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)
                  throws IOException

        Saves the OneNote document to a file.

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

        public void save(OutputStream stream)
                  throws IOException

        Saves the OneNote document to a stream.

        Parameters:
        stream - The System.iO.stream where the document will be saved.
        Throws:
        com.aspose.note.infrastructure.IncorrectDocumentStructureException - The document structure violates specification.
        com.aspose.note.infrastructure.UnsupportedSaveFormatException - Requested save format is not supported.
        IOException
      • 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:
        com.aspose.note.infrastructure.IncorrectDocumentStructureException - The document structure violates specification.
        com.aspose.note.infrastructure.UnsupportedSaveFormatException - Requested save format is not supported.
        IOException
      • save

        public void save(OutputStream stream,
                         int format)
                  throws IOException

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

        Parameters:
        stream - The System.iO.stream where the document will be saved.
        format - The format in which to save the document.
        Throws:
        com.aspose.note.infrastructure.IncorrectDocumentStructureException - The document structure violates specification.
        com.aspose.note.infrastructure.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:
        com.aspose.note.infrastructure.IncorrectDocumentStructureException - The document structure violates specification.
        com.aspose.note.infrastructure.UnsupportedSaveFormatException - Requested save format is not supported.
        IOException
      • save

        public void save(OutputStream stream,
                         SaveOptions options)
                  throws IOException

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

        Parameters:
        stream - The System.iO.stream where the document will be saved.
        options - Specifies the options how the document is saved in stream.
        Throws:
        com.aspose.note.infrastructure.IncorrectDocumentStructureException - The document structure violates specification.
        com.aspose.note.infrastructure.UnsupportedSaveFormatException - Requested save format is not supported.
        IOException
      • print

        public void print(PrintOptions options)
                   throws PrintException

        Prints the document using the default printer.

        Parameters:
        options - Options used to print a document. Can be null.
        Throws:
        PrintException
      • 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.