문제

My application allows the user to insert information into a document (using document properties and variables). Part of this is also that they should be able to adjust the values they have previously entered. Changing the Name and Value of a document property is no problem, but apparently the variable Name has a get property only, no set property. This is how I'm assigning a variable:

object v = _name;
Variables.Add(_sName, ref v);

This is how I'd ideally change the variable.

var.Name = newName;

But it gives an error saying:

Property or indexer 'Word.Variable.Name' cannot be assigned to -- it is read only

The only option I can think of is deleting the variable and creating a new one with the updated values. But is that really my only option?

도움이 되었습니까?

해결책

I went ahead and solved it by simply changing the name and value of the document property, but also removing the variables and creating new ones with the updated values. As far as I know that's the only way to go about it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top