VariableCollectionAdd Method |
Adds a document variable to the collection.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic void Add(
string name,
string value
)
Public Sub Add (
name As String,
value As String
)
public:
void Add(
String^ name,
String^ value
)
member Add :
name : string *
value : string -> unit
Parameters
- name
- Type: SystemString
The case-insensitive name of the variable to add. - value
- Type: SystemString
The value of the variable. The value cannot be null, if value is null empty string will be used instead.
ExamplesShows how to create document variables and add them to a document's variable collection.
Document doc = new Document(MyDir + "Document.docx");
doc.Variables.Add("doc", "Word processing document");
doc.Variables.Add("docx", "Word processing document");
doc.Variables.Add("txt", "Word processing document");
doc.Variables.Add("txt", "Plain text file");
doc.Variables.Add("bmp", "Image");
doc.Variables.Add("png", "Image");
See Also