.... having looked into the
Styles.cs file myself I think there may be an issue at the end of the method
public override void Add(DocumentObject value) that clones and inserts the new style into the
Styles collection
the following changes fix my initial observations
Code:
public override void Add(DocumentObject value)
{
:
:
if (baseStyle != null)
{ // inserted
string originalName = style.name.Value; // inserted
string originalBaseStyleName= style.baseStyle.Value; // inserted
style = baseStyle.Clone(); // inserted
style.name.Value = originalName; // inserted
style.baseStyle.Value = originalBaseStyleName; // inserted
// style.styleType.Value = (int)baseStyle.Type; // removed
} // inserted
int index = GetIndex(style.Name);
if (index >= 0)
{
style = style.Clone();
style.parent = this;
((IList)this)[index] = style;
}
else
base.Add(style); // changed
}
and finally in the method
public Style AddStyle(string name, string baseStyleName) the final line should return the style just inserted (which may have changed:
Code:
public Style AddStyle(string name, string baseStyleName)
{
:
:
return this[name]; // changed
}
however you have the test suite (!) so that probably buggers up a whole manner of other things!
I'd be interested to know whether the above is indeed the correct workaround or whether I am barking up the wrong tree entirely