DocumentPropertyCollection.Contains

DocumentPropertyCollection.Contains method

Returns true if a property with the specified name exists in the collection.

public bool Contains(string name)
ParameterTypeDescription
nameStringThe case-insensitive name of the property.

Return Value

True if the property exists in the collection; false otherwise.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class DocumentPropertyCollectionMethodContainsWithStringDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Check if "RevisionNumber" property exists in built-in document properties
            bool containsRevision = workbook.BuiltInDocumentProperties.Contains("RevisionNumber");
            Console.WriteLine("Contains 'RevisionNumber': " + containsRevision);
            
            // Add a custom property and check for its existence
            workbook.CustomDocumentProperties.Add("CustomProperty", "Test Value");
            bool containsCustom = workbook.CustomDocumentProperties.Contains("CustomProperty");
            Console.WriteLine("Contains 'CustomProperty': " + containsCustom);
        }
    }
}

See Also