Word Document variables not accessible in Aspose.words.dokument

Hi,

I have a word document with document variables. When I load the text in Aspose.Words. The collection doc.variables is empty (Count = 0)

What am I doing wrong.

Thanks

Manfred

P.S. Is the problem with ‘Includepicture Mergefield’ solved?

Hello
Thanks for your request. There is no any DocumentVariable inside your document. There are Merge Fields. To get a collection of mail merge field names available in the document you should use the following code:

string[] fieldNames = doc.MailMerge.GetFieldNames();

Please see the following information to learn more:
https://reference.aspose.com/words/net/aspose.words.mailmerging/mailmerge/getfieldnames/
What a problem with Includepicture Mergefield fileds do you mean?
Best regards,

Hello Andrey,

yes there are a lot of mergefileds but a document variable too, the line after ‘IMMOPOOL Expose…’

Problem with Includepicture look here:
Extract Mailmergefield from within Includepicture

IMMOPOOL Exposé-Generator-Details
Eignung/Zweck
«Ï3Ï9399ÏEignungZweck»

Hello
Thanks for your request. It is just a link to Document Variable. Please try using the following code:

Document doc = new Document("C:\\Temp\\yourDoc.doc");
// Add new Document Variable
doc.Variables.Add("DETAIL702-02-Baustein-ExpGen-Checkliste.doc", "ValueOfVariable");
// Get collection
VariableCollection collection = doc.Variables;
doc.UpdateFields();
doc.Save("C:\\Temp\\out.doc");

Best regards,