You can get a collection of document variables using the Variables property. Variable names and values are strings.
Example GetDocumentVariables
Shows how to enumerate over document variables.
[C#]
Document doc = new Document(MyDir + "Document.doc");
foreach (DictionaryEntry entry in doc.Variables)
{
string name = entry.Key.ToString();
string value = entry.Value.ToString();
// Do something useful.
Console.WriteLine("Name: {0}, Value: {1}", name, value);
}
[Visual Basic]
Dim doc As Document = New Document(MyDir & "Document.doc")
For Each entry As DictionaryEntry In doc.Variables
Dim name As String = entry.Key.ToString()
Dim value As String = entry.Value.ToString()
' Do something useful.
Console.WriteLine("Name: {0}, Value: {1}", name, value)
Next entry
[Java]
Document doc = new Document(getMyDir() + "Document.doc");
for (Map.Entry entry : doc.getVariables().entrySet())
{
String name = entry.getKey().toString();
String value = entry.getValue().toString();
// Do something useful.
System.out.println(MessageFormat.format("Name: {0}, Value: {1}", name, value));
}