Interface ICustomDocumentProperties
Represents the custom document properties.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface ICustomDocumentProperties
Properties
Count
Gets the number of document properties in the presentation. Read-only.
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("Property1");
//Set a Boolean value.
customDocumentProperties["Property1"].Boolean = true;
//Add a new custom document property
customDocumentProperties.Add("Property2");
//Set a date time.
customDocumentProperties["Property2"].DateTime = DateTime.Now;
//Add a new custom document property
customDocumentProperties.Add("Property3");
//Sets a four byte signed integer value.
customDocumentProperties["Property3"].Int32 = 256;
//Get the count of custom document properties, read only
int count = customDocumentProperties.Count;
//Save the presentation
presentation.Save("Count.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("Property1")
'Set a Boolean value.
customDocumentProperties("Property1").[Boolean] = True
'Add a new custom document property
customDocumentProperties.Add("Property2")
'Set a date time.
customDocumentProperties("Property2").DateTime = DateTime.Now
'Add a new custom document property
customDocumentProperties.Add("Property3")
'Sets a four byte signed integer value.
customDocumentProperties("Property3").Int32 = 256
'Get the count of custom document properties, read only
Dim count As Integer = customDocumentProperties.Count
'Save the presentation
presentation__1.Save("Count.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets a IDocumentProperty instance at the specified index of document property collection. Read-only.
Declaration
IDocumentProperty this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element. |
Property Value
Type | Description |
---|---|
IDocumentProperty | Returns the element at the particular index. |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("Property1");
//Set a Boolean value.
customDocumentProperties["Property1"].Boolean = true;
//Add a new custom document property
customDocumentProperties.Add("Property2");
//Set a date time.
customDocumentProperties["Property2"].DateTime = DateTime.Now;
//Get the property at specific index, read only
IDocumentProperty documentProperty = customDocumentProperties[0];
//Save the presentation
presentation.Save("CustomProperty.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("Property1")
'Set a Boolean value.
customDocumentProperties("Property1").[Boolean] = True
'Add a new custom document property
customDocumentProperties.Add("Property2")
'Set a date time.
customDocumentProperties("Property2").DateTime = DateTime.Now
'Get the property at specific index, read only
Dim documentProperty As IDocumentProperty = customDocumentProperties(0)
'Save the presentation
presentation__1.Save("CustomProperty.pptx")
'Close the presentation
presentation__1.Close()
Item[String]
Gets a IDocumentProperty instance with the specified name, from the document property collection. Read-only.
Declaration
IDocumentProperty this[string strName] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | strName | The name of the document property to locate. |
Property Value
Type | Description |
---|---|
IDocumentProperty | Returns the element at the particular name. |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("Property1");
//Set a Boolean value.
customDocumentProperties["Property1"].Boolean = true;
//Add a new custom document property
customDocumentProperties.Add("Property2");
//Set a date time.
customDocumentProperties["Property2"].DateTime = DateTime.Now;
//Get the specific property, read only
IDocumentProperty documentProp = customDocumentProperties["Property1"];
//Save the presentation
presentation.Save("CustomProperty.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("Property1")
'Set a Boolean value.
customDocumentProperties("Property1").[Boolean] = True
'Add a new custom document property
customDocumentProperties.Add("Property2")
'Set a date time.
customDocumentProperties("Property2").DateTime = DateTime.Now
'Get the specific property, read only
Dim documentProp As IDocumentProperty = customDocumentProperties("Property1")
'Save the presentation
presentation__1.Save("CustomProperty.pptx")
'Close the presentation
presentation__1.Close()
Methods
Add(String)
Adds a document property to the presentation with the specified name.
Declaration
IDocumentProperty Add(string strName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strName | The name of the document property. |
Returns
Type | Description |
---|---|
IDocumentProperty | The IDocumentProperty instance |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("Property1");
//Set a Boolean value.
customDocumentProperties["Property1"].Boolean = true;
//Save the presentation
presentation.Save("Output.pptx");
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("Property1")
'Set a Boolean value.
customDocumentProperties("Property1").[Boolean] = True
'Save the presentation
presentation__1.Save("Output.pptx")
Clear()
Removes all the document properties from the presentation.
Declaration
void Clear()
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("Property1");
//Set a Boolean value.
customDocumentProperties["Property1"].Boolean = true;
//Add a new custom document property
customDocumentProperties.Add("Property2");
//Set a date time.
customDocumentProperties["Property2"].DateTime = DateTime.Now;
//Clear the properties
customDocumentProperties.Clear();
//Save the presentation
presentation.Save("Clear.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("Property1")
'Set a Boolean value.
customDocumentProperties("Property1").[Boolean] = True
'Add a new custom document property
customDocumentProperties.Add("Property2")
'Set a date time.
customDocumentProperties("Property2").DateTime = DateTime.Now
'Clear the properties
customDocumentProperties.Clear()
'Save the presentation
presentation__1.Save("Clear.pptx")
'Close the presentation
presentation__1.Close()
Contains(String)
Determines whether the property with specified name is in the document property collection.
Declaration
bool Contains(string strName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strName | The name of the document property to locate. |
Returns
Type | Description |
---|---|
System.Boolean | true if property is present in the collection; otherwise, false. |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("PropertyA");
//Check if the item exist in document properties
if (customDocumentProperties.Contains("PropertyA"))
//Sets a four byte signed integer value.
customDocumentProperties["PropertyA"].Int32 = 256;
//Save the presentation
presentation.Save("Clear.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("PropertyA")
'Check if the item exist in document properties
If customDocumentProperties.Contains("PropertyA") Then
'Sets a four byte signed integer value.
customDocumentProperties("PropertyA").Int32 = 256
End If
'Save the presentation
presentation__1.Save("Clear.pptx")
'Close the presentation
presentation__1.Close()
Remove(String)
Removes the property with specified name, from the document property collection.
Declaration
void Remove(string strName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strName | The name of the property to remove. |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("PropertyA");
//Check if the item exist in document properties and remove
if (customDocumentProperties.Contains("PropertyA"))
customDocumentProperties.Remove("PropertyA");
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("PropertyA")
'Check if the item exist in document properties and remove
If customDocumentProperties.Contains("PropertyA") Then
customDocumentProperties.Remove("PropertyA")
End If
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()