L
lmxu
Hi,
I have a need to change certain custom propertie value of the word document.
I have a mehtod like so
private void changeWordCustomProperty(String changeText, String changeValue)
{
Word._Document oDoc;
object oDocCustomProps;
try
{
oDoc = this.wordApp.ActiveDocument;
oDocCustomProps = oDoc.CustomDocumentProperties;
Type typeDocCustomProps = oDocCustomProps.GetType();
object[] oArgs = {changeText,false,
MsoDocProperties.msoPropertyTypeString,
changeValue};
typeDocCustomProps.InvokeMember("Item",BindingFlags.Default |
BindingFlags.SetProperty, null,
oDocCustomProps, new object[]{changeText,changeValue} );
}
catch(Exception e)
{
Console.WriteLine(e.StackTrace);
}
}
using the debugger, I see the text and value passed in are both correct.
However, this mehtod is NOT changing the value of the custom property. after
it's called. I went to word file->properties->custom tab, i see the value is
still the same. What went wrong?
btw, using the debugger, i don't see exception being thrown either. Advice
and tips is really appreicated. thanks
I have a need to change certain custom propertie value of the word document.
I have a mehtod like so
private void changeWordCustomProperty(String changeText, String changeValue)
{
Word._Document oDoc;
object oDocCustomProps;
try
{
oDoc = this.wordApp.ActiveDocument;
oDocCustomProps = oDoc.CustomDocumentProperties;
Type typeDocCustomProps = oDocCustomProps.GetType();
object[] oArgs = {changeText,false,
MsoDocProperties.msoPropertyTypeString,
changeValue};
typeDocCustomProps.InvokeMember("Item",BindingFlags.Default |
BindingFlags.SetProperty, null,
oDocCustomProps, new object[]{changeText,changeValue} );
}
catch(Exception e)
{
Console.WriteLine(e.StackTrace);
}
}
using the debugger, I see the text and value passed in are both correct.
However, this mehtod is NOT changing the value of the custom property. after
it's called. I went to word file->properties->custom tab, i see the value is
still the same. What went wrong?
btw, using the debugger, i don't see exception being thrown either. Advice
and tips is really appreicated. thanks