Class UnsupportedFileFormatException

Class UnsupportedFileFormatException

Namespace: Aspose.Note
Assembly: Aspose.Note.dll (25.6.0)

Thrown during document load, when the file format is not recognized or not supported by Aspose.Note.

public class UnsupportedFileFormatException : Exception, ISerializable
{
    public UnsupportedFileFormatException()
    {
    }
    protected UnsupportedFileFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        : base(info, context)
    {
    }
}

Inheritance

object Exception UnsupportedFileFormatException

Implements

ISerializable

Inherited Members

Exception.GetBaseException() , Exception.ToString() , Exception.GetType() , Exception.TargetSite , Exception.Message , Exception.Data , Exception.InnerException , Exception.HelpLink , Exception.Source , Exception.HResult , Exception.StackTrace , Exception.SerializeObjectState , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Shows how to check if a document load is failed because OneNote 2007 format is not supported.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   string fileName = Path.Combine(dataDir, "OneNote2007.one");
   try
   {
      new Document(fileName);
   }
   catch (UnsupportedFileFormatException e)
   {
      if (e.FileFormat == FileFormat.OneNote2007)
      {
         Console.WriteLine("It looks like the provided file is in OneNote 2007 format that is not supported.");
      }
      else
      {
         throw;
      }
   }

Constructors

UnsupportedFileFormatException(SerializationInfo, StreamingContext)

Initializes a new instance of the Aspose.Note.UnsupportedFileFormatException class.

protected override UnsupportedFileFormatException
   {
      get
      {
         SerializationInfo serializationInfo;
         StreamingContext synchronizationContext;
         base(serializationInfo, synchronizationContext);
      }
   }

Parameters

serializationInfo SerializationInfo

The serialization info.

synchronizationContext StreamingContext

The synchronization context.

Properties

FileFormat

Gets the file format of passed data if detected.

public FileFormat GetFileFormat()
    {
    }

Property Value

FileFormat

Examples

Shows how to check if a document load is failed because OneNote 2007 format is not supported.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   string fileName = Path.Combine(dataDir, "OneNote2007.one");
   try
   {
       new Document(fileName);
   }
   catch (UnsupportedFileFormatException e)
   {
      if (e.FileFormat == FileFormat.OneNote2007)
      {
         Console.WriteLine("It looks like the provided file is in OneNote 2007 format that is not supported.");
      }
      else
      {
         throw;
      }
   }
 English