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.
Custom properties can be added by code or using the ribbonBar at runtime. To do so, follow the steps below.
Using Code
C# Copy Code// Open dialog using code FarPoint.Win.Spread.Dialogs.BuiltInDialogs.DocumentProperties(fpSpread1.AsWorkbook());
VB Copy Code' Open dialog using code FarPoint.Win.Spread.Dialogs.BuiltInDialogs.DocumentProperties(FpSpread1.AsWorkbook())
Using RibbonBar
i. Run the code below to attach the ribbonBar with fpSpread.
C# Copy Code ribbonBar1.Attach(fpSpread1);
VB Copy Code ribbonBar1.Attach(FpSpread1)
ii. Open the File menu.
iii. Select Properties. The Properties dialog appears.
Using Code
The following example code shows how to add custom properties to the Properties dialog.
C# Copy Code // 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());
VB Copy Code ' 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
i. Click on the Custom tab and provide the following details:
ii. Click Add.
The custom property gets added to the Properties table.
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.