Class CustomDocumentProperties
Represents the custom document properties for the specified document.
Implements
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class CustomDocumentProperties : XDLSSerializableBase, IXDLSSerializable
Examples
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Load an existing Word document into DocIO instance
WordDocument document = new WordDocument("Template.docx");
//Add the new custom property Typist with value
document.CustomDocumentProperties.Add("Typist", "Andrew");
//Add the new custom property Publisher with value
document.CustomDocumentProperties.Add("Publisher", "Stephen");
//Add the new custom property Recorded by with value
document.CustomDocumentProperties.Add("Recorded by", "Harry");
//Add the new custom property Recorded date with value
document.CustomDocumentProperties.Add("Recorded date", new DateTime(2015, 2, 23));
//Save and close the Word document
document.Save("Result.docx", FormatType.Docx);
document.Close();
}
Private Sub button_Click(sender As Object, e As EventArgs)
'Load an existing Word document into DocIO instance
Dim document As New WordDocument("Template.docx")
'Add the new custom property Typist with value
document.CustomDocumentProperties.Add("Typist", "Andrew")
'Add the new custom property Publisher with value
document.CustomDocumentProperties.Add("Publisher", "Stephen")
'Add the new custom property Recorded by with value
document.CustomDocumentProperties.Add("Recorded by", "Harry")
'Add the new custom property Recorded date with value
document.CustomDocumentProperties.Add("Recorded date", New DateTime(2015, 2, 23))
'Save and close the Word document
document.Save("Result.docx", FormatType.Docx)
document.Close()
End Sub
Fields
m_customList
Sorted list of properties
Declaration
protected Dictionary<string, DocumentProperty> m_customList
Field Value
| Type |
|---|
| System.Collections.Generic.Dictionary<System.String, DocumentProperty> |
Properties
Count
Gets the total number of custom properties in the document. Read-only.
Declaration
public int Count { get; }
Property Value
| Type |
|---|
| System.Int32 |
Item[Int32]
Gets the custom property by specified index. Read-only.
Declaration
public DocumentProperty this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Property Value
| Type |
|---|
| DocumentProperty |
Item[String]
Gets the custom property by specified name. Read-only.
Declaration
public DocumentProperty this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name |
Property Value
| Type |
|---|
| DocumentProperty |
Methods
Add(String, Object)
Adds the new custom document property with specified name and its value.
Declaration
public DocumentProperty Add(string name, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | A |
| System.Object | value | The value for the property. |
Returns
| Type | Description |
|---|---|
| DocumentProperty | The new DocumentProperty this method creates. |
Clone()
Creates a duplicate copy of this CustomDocumentProperties
Declaration
public CustomDocumentProperties Clone()
Returns
| Type | Description |
|---|---|
| CustomDocumentProperties | The newly created duplicate copy of the current |
Remove(String)
Removes the specified custom property from the document.
Declaration
public void Remove(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | A |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | The specified property is not present in the document. |