VariableCollection Class |
Namespace: Aspose.Words
The VariableCollection type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | Count |
Gets the number of elements contained in the collection.
|
![]() | ItemInt32 |
Gets or sets a document variable at the specified index.
null values are not allowed as a right hand side of the assignment and will be replaced by empty string.
|
![]() | ItemString |
Gets or a sets a document variable by the case-insensitive name.
null values are not allowed as a right hand side of the assignment and will be replaced by empty string.
|
Name | Description | |
---|---|---|
![]() ![]() | Add |
Adds a document variable to the collection.
|
![]() ![]() | Clear |
Removes all elements from the collection.
|
![]() ![]() | Contains |
Determines whether the collection contains a document variable with the given name.
|
![]() | Equals | (Inherited from Object.) |
![]() ![]() | GetEnumerator |
Returns an enumerator object that can be used to iterate over all variable in the collection.
|
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() ![]() | IndexOfKey |
Returns the zero-based index of the specified document variable in the collection.
|
![]() ![]() | Remove |
Removes a document variable with the specified name from the collection.
|
![]() ![]() | RemoveAt |
Removes a document variable at the specified index.
|
![]() | ToString | (Inherited from Object.) |
Variable names and values are strings.
Variable names are case-insensitive.
Document doc = new Document(MyDir + "Document.docx"); foreach (KeyValuePair<string, string> entry in doc.Variables) { string name = entry.Key; string value = entry.Value; // Do something useful Console.WriteLine("Name: {0}, Value: {1}", name, value); }