WarningInfoCollection Class
Represents a typed collection of WarningInfo objects.
Inheritance Hierarchy

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
public class WarningInfoCollection : IWarningCallback, 
	IEnumerable<WarningInfo>, IEnumerable

The WarningInfoCollection type exposes the following members.

Public methodWarningInfoCollection
Initializes a new instance of the WarningInfoCollection class
Public propertyCount
Gets the number of elements contained in the collection.
Public propertyItem
Gets an item at the specified index.
Public methodCode exampleClear
Removes all elements from the collection.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode exampleGetEnumerator
Returns an enumerator object that can be used to iterate over all items in the collection.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodCode exampleWarning
Implements the IWarningCallback interface. Adds a warning to this collection.

You can use this collection object as the simplest form of IWarningCallback implementation to gather all warnings that Aspose.Words generates during a load or save operation. Create an instance of this class and assign it to the WarningCallback or WarningCallback property.

Shows how to implement the IWarningCallback to be notified of any font substitution during document save.

public class HandleDocumentWarnings : IWarningCallback
    /// <summary>
    /// Our callback only needs to implement the "Warning" method. This method is called whenever there is a
    /// potential issue during document processing. The callback can be set to listen for warnings generated during document
    /// load and/or document save.
    /// </summary>
    public void Warning(WarningInfo info)
        // We are only interested in fonts being substituted.
        if (info.WarningType == WarningType.FontSubstitution)
            Console.WriteLine("Font substitution: " + info.Description);

See Also