# Adding Custom Properties

adding custom properties at workbook or worksheet level

## Content

Custom properties are metadata fields that you can add to a workbook to describe its content, purpose, or other relevant information. You can add text, date, or numeric values to custom properties and choose a custom name from a list of suggested names. You can also assign them the values yes or no.
To add additional custom properties, you can use the **CustomDocumentProperties** object of the **IDocumentProperties** Interface. It represents all the custom properties of the workbook.
Spread Designer also provides you an option for custom properties of the workbook in the **File** \> **Properties** \> **Custom** tab.
![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/custom%20properties%20dialog.gif)
Custom properties can be added by code or using the ribbonBar at runtime. To do so, follow the steps below.
1\. Open the **Properties** dialog.
**Using Code**

```csharp
// Open dialog using code
FarPoint.Win.Spread.Dialogs.BuiltInDialogs.DocumentProperties(fpSpread1.AsWorkbook());
```

```vbnet
' Open dialog using code
FarPoint.Win.Spread.Dialogs.BuiltInDialogs.DocumentProperties(FpSpread1.AsWorkbook())
```

**Using RibbonBar**

1. Run the code below to attach the ribbonBar with fpSpread.

    ```csharp
    ribbonBar1.Attach(fpSpread1);
    ```

    ```vbnet
    ribbonBar1.Attach(FpSpread1)
    ```
2. Open the File menu.
3. Select Properties. The Properties dialog appears.

2\. Add custom properties to the **Properties** dialog.
**Using Code**
The following example code shows how to add custom properties to the **Properties** dialog.

```csharp
// Add properties using code
fpSpread1.AsWorkbook().CustomDocumentProperties.Add("Client", GrapeCity.Core.DocumentPropertyType.Boolean, true);
fpSpread1.AsWorkbook().CustomDocumentProperties.Add("Date completed", GrapeCity.Core.DocumentPropertyType.Date, new System.DateTime(2023, 3, 12));
fpSpread1.AsWorkbook().CustomDocumentProperties.Add("Document number", GrapeCity.Core.DocumentPropertyType.Number, 123);
fpSpread1.AsWorkbook().CustomDocumentProperties.Add("Language", GrapeCity.Core.DocumentPropertyType.String, "English");
FarPoint.Win.Spread.Dialogs.BuiltInDialogs.DocumentProperties(fpSpread1.AsWorkbook());
```

```vbnet
' Add properties using code
FpSpread1.AsWorkbook().CustomDocumentProperties.Add("Client", GrapeCity.Core.DocumentPropertyType.[Boolean], True)
FpSpread1.AsWorkbook().CustomDocumentProperties.Add("Date completed", GrapeCity.Core.DocumentPropertyType.[Date], New DateTime(2023, 3, 12))
FpSpread1.AsWorkbook().CustomDocumentProperties.Add("Document number", GrapeCity.Core.DocumentPropertyType.Number, 123)
FpSpread1.AsWorkbook().CustomDocumentProperties.Add("Language", GrapeCity.Core.DocumentPropertyType.[String], "English")
FarPoint.Win.Spread.Dialogs.BuiltInDialogs.DocumentProperties(FpSpread1.AsWorkbook())
```

**Using RibbonBar**

1. Click on the Custom tab and provide the following details:
    * In the **Name** list, select a name from the list.
    * In the **Type** list, select the data type for the property to be added.
    * In the **Value** box, type a value for the property.
        The value that you type must match the selection in the Type list. For example, if you select a Number in the Type list, you must type a number in the Value box.
2. Click **Add**.

The custom property gets added to the Properties table.

## Modify/ Delete Custom Properties of Workbook

Spread also allows you to edit or delete an existing custom property as per your requirement. To make changes, select the property name from the **Properties** table, make the necessary edits, and then click the **Modify** button to save the changes. Similarly, you may delete an unwanted custom property by selecting the property name and then clicking the **Delete** button.

## Modify/Delete Custom Properties of Worksheet

Spread allows the user to add identifier information to a worksheet called custom properties. [CustomProperties](/spreadnet/api/latest/online-win/GrapeCity.Spreadsheet/GrapeCity.Spreadsheet.IWorksheet.CustomProperties.html) are used to store additional metadata or information related to the worksheet. To add custom properties to a worksheet, use the **CustomProperties** property of the [IWorksheet](/spreadnet/api/latest/online-win/GrapeCity.Spreadsheet/GrapeCity.Spreadsheet.IWorksheet.html) interface. You can add the **CustomProperties** to a worksheet only programmatically.
You can also use Add/Delete method of **CustomProperties** for adding/removing the metadata to a worksheet.
Consider the following example code to add and delete the identifier information at worksheet level.

```csharp
IWorksheet sheet = fpSpread1.AsWorkbook().ActiveSheet;
object[,] properties = new object[,] { { "Department", 3 },
                             { "Editor", "Serena"},
                             { "Project", "Spread"},
                             { "Status", true} };
for (int i = 0; i < 4; i++)
  {
     sheet.CustomProperties.Add(properties[i, 0].ToString(), properties[i, 1]);
  }
sheet.CustomProperties[0].Delete();
sheet.CustomProperties[0].Delete();
Console.WriteLine(sheet.CustomProperties[0].Name);
Console.WriteLine(sheet.CustomProperties[1].Name);
```

```vbnet
Dim sheet As IWorksheet = FpSpread1.AsWorkbook().ActiveSheet
Dim properties As Object(,) = New Object(,) {
            {"Department", 3},
            {"Editor", "Serena"},
            {"Project", "Spread"},
            {"Status", True}}
For i As Integer = 0 To 4 - 1
    sheet.CustomProperties.Add(properties(i, 0).ToString(), properties(i, 1))
Next
sheet.CustomProperties(0).Delete()
sheet.CustomProperties(0).Delete()
Console.WriteLine(sheet.CustomProperties(0).Name)
Console.WriteLine(sheet.CustomProperties(1).Name)
```

## See Also

[Saving to a Spread XML File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-spreadfile)
[Saving to an Excel File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-excelfile)
[Saving to a PDF File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-pdffile)
[Saving to a Text File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-texttfile)
[Saving to an Image File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-imagefile)
[Saving to an HTML File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-htmlfile)
[Saving to an HTML Table](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-htmltable)
[Saving Spreadsheet Data to Simple XML](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-dataxml)