A
Alex
In my C# Word add-in, I use a custom template to hold the customization context.
In certain cases, after I add/remove controls, the template is marked "dirty" and setting template.Saved = true does not clear it.
Here's the offending function:
private void CustomizeUI()
{
// Save customization context
object customizationContext = app.CustomizationContext;
try
{
// Set the template as the new customization context
app.CustomizationContext = template;
SetupCommandBars();
}
finally
{
// Mark the template as saved and restore customization context
app.CustomizationContext = customizationContext;
template.Saved = true;
}
}
If I comment out the call to SetupCommandBars(), I do not get the prompt to save the template on exit.
However, I explicitly set it's Saved status.
I also tried putting "template.Saved = true" in other places in the code with no effect.
What can be the problem?
In certain cases, after I add/remove controls, the template is marked "dirty" and setting template.Saved = true does not clear it.
Here's the offending function:
private void CustomizeUI()
{
// Save customization context
object customizationContext = app.CustomizationContext;
try
{
// Set the template as the new customization context
app.CustomizationContext = template;
SetupCommandBars();
}
finally
{
// Mark the template as saved and restore customization context
app.CustomizationContext = customizationContext;
template.Saved = true;
}
}
If I comment out the call to SetupCommandBars(), I do not get the prompt to save the template on exit.
However, I explicitly set it's Saved status.
I also tried putting "template.Saved = true" in other places in the code with no effect.
What can be the problem?