[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ICustomDocumentPropertyCollection.Add

Add Method

Add(string, string)

Creates a new IDocumentProperty with a string value and adds it to the custom document properties available for the current Workbook.

Declaration
IDocumentProperty Add(string name, string value)
Function Add(name As String, value As String) As IDocumentProperty
Parameters
Type Name Description
string name

The name of the new IDocumentProperty.

string value

The string value of the property.

Returns
Type Description
IDocumentProperty

The new IDocumentProperty.

Examples
IDocumentProperty property = workbook.CustomDocumentProperties.Add("Department", "Sales");

Add(string, int)

Creates a new custom document property with an integer value and adds it to the current Workbook.

Declaration
IDocumentProperty Add(string name, int value)
Function Add(name As String, value As Integer) As IDocumentProperty
Parameters
Type Name Description
string name

The name of the new IDocumentProperty.

int value

The integer value of the property.

Returns
Type Description
IDocumentProperty

The new IDocumentProperty.

Examples
IDocumentProperty property = workbook.CustomDocumentProperties.Add("Revision", 3);
object value = property.Value;

Add(string, DateTime)

Creates a new IDocumentProperty with a date and time value and adds it to the custom document properties available for the current Workbook.

Declaration
IDocumentProperty Add(string name, DateTime value)
Function Add(name As String, value As Date) As IDocumentProperty
Parameters
Type Name Description
string name

The name of the new IDocumentProperty.

DateTime value

The date and time value of the property.

Returns
Type Description
IDocumentProperty

The new IDocumentProperty.

Examples
IDocumentProperty property = workbook.CustomDocumentProperties.Add("PublishedOn", new DateTime(2024, 3, 15, 10, 30, 0));
PropertyType type = property.Type;

Add(string, bool)

Creates a new IDocumentProperty with a Boolean value and adds it to the custom document properties available for the current Workbook.

Declaration
IDocumentProperty Add(string name, bool value)
Function Add(name As String, value As Boolean) As IDocumentProperty
Parameters
Type Name Description
string name

The name of the new IDocumentProperty.

bool value

The Boolean value of the property.

Returns
Type Description
IDocumentProperty

The new IDocumentProperty.

Examples
IDocumentProperty property = workbook.CustomDocumentProperties.Add("IsReviewed", true);

Add(string, double)

Creates a new IDocumentProperty with a double-precision floating-point value and adds it to the custom document properties of the current Workbook.

Declaration
IDocumentProperty Add(string name, double value)
Function Add(name As String, value As Double) As IDocumentProperty
Parameters
Type Name Description
string name

The new IDocumentProperty name.

double value

The double value of the property.

Returns
Type Description
IDocumentProperty

The new IDocumentProperty.

Examples
IDocumentProperty property = workbook.CustomDocumentProperties.Add("Price", 19.95);
PropertyType type = property.Type;