Completed
Last Updated: 14 Jun 2016 07:29 by ADMIN
ADMIN
Deyan
Created on: 25 Apr 2016 18:35
Category: WordsProcessing
Type: Bug Report
0
Document default style properties are not cloned
The document default style properties are not cloned on document.Clone().
There is a workaround by using the following code:

var cloning = this.document.Clone();
ClearPropertiesWithoutValueAndSetLocalValues(this.document.DefaultStyle.CharacterProperties, cloning.DefaultStyle.CharacterProperties);
ClearPropertiesWithoutValueAndSetLocalValues(this.document.DefaultStyle.ParagraphProperties, cloning.DefaultStyle.ParagraphProperties);

private void ClearPropertiesWithoutValueAndSetLocalValues(DocumentElementPropertiesBase propertiesFrom, DocumentElementPropertiesBase propertiesTo)

{
	foreach (var stylePropertyFrom in propertiesFrom.StyleProperties)
	{
		var stylePropertyTo = propertiesTo.GetStyleProperty(stylePropertyFrom.PropertyDefinition);
		stylePropertyTo.ClearValue();
		if (stylePropertyFrom.HasLocalValue)
		{
			object value = stylePropertyTo.GetLocalValueAsObject();
			stylePropertyTo.SetValueAsObject(value);
		}
	}
}
1 comment
ADMIN
Aylin
Posted on: 14 Jun 2016 07:29
Hi,

The issue is fixed and will be live in our upcoming 2016 R2 SP1 release.

Regards,
Aylin,
The Telerik Team