Expand Minimize

WorksheetBase.CustomProperties Property

Gets a Microsoft.Office.Interop.Excel.CustomProperties object representing the identifier information associated with a worksheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public CustomProperties CustomProperties { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.CustomProperties
A Microsoft.Office.Interop.Excel.CustomProperties object representing the identifier information associated with a worksheet.

The following code example uses the CustomProperties property to add a custom property named "Microsoft" with the value "MSFT" to the current worksheet. The example then iterates through the collection of custom properties until it finds the "Microsoft" property, and sets the value of this property to the cell A1.

This example is for a document-level customization.

private void AddStockSymbol()
{
    this.CustomProperties.Add("Microsoft", "MSFT");

    for (int i = 1; i <= this.CustomProperties.Count; i++)
    {
        if (this.CustomProperties.get_Item(i).Name == "Microsoft")
        {
            this.Range["A1"].Value2 =
                this.CustomProperties.get_Item(i).Value.ToString();
            return;
        }
    }
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft