Class UnsupportedFileFormatException

Class UnsupportedFileFormatException

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

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

public class UnsupportedFileFormatException : Exception, ISerializable

Inheritance

objectExceptionUnsupportedFileFormatException

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.```csharp // The path to the documents directory. 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

### <a id="Aspose_Note_UnsupportedFileFormatException__ctor_System_Runtime_Serialization_SerializationInfo_System_Runtime_Serialization_StreamingContext_"></a> UnsupportedFileFormatException\(SerializationInfo, StreamingContext\)

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

```csharp
protected UnsupportedFileFormatException(SerializationInfo serializationInfo, StreamingContext 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 FileFormat { get; }

Property Value

FileFormat

Examples

Shows how to check if a document load is failed because OneNote 2007 format is not supported.```csharp // The path to the documents directory. 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;
                                                                                                    }