I'm trying to create a new word document from a template using the following javascript code :
var word = new ActiveXObject("Word.Application"); var doc = word.Documents.Add("/server/docLib/ContentType/template.dotx"); before i display the word application, i want to initialize some content types properties :
doc.ContentTypeProperties.GetItemByInternalName("field1_internalName").Value = "MyValue" The previous code works fine. But when I try to set a property of type Lookup, an exception is raised with no error description.
To see what was wrong, i used the following code to open an existing document with all properties filled.
var word = new ActiveXObject("Word.Application"); var doc = word.Documents.Open("/server/docLib/doc1.docx"); var ct = doc.ContentTypeProperties; var lookupprop = ct.GetItemByInternalName("field1_internalName"); After debugging, I found that lookupprop is an object of type MetaProperty and contains somme fields like Type, ID... etc. and Value of type Variant. when i tried to acces the value, the same exception was raised.
My question is : Is it possible to set a lookup properties like this? and if yes how?