Declined
Last Updated: 22 Feb 2017 12:33 by ADMIN
ADMIN
Mihail
Created on: 06 Apr 2016 16:07
Category: UI for WPF
Type: Bug Report
0
Moved to TDP: 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);
		}
	}
}
This item is migrated to the Telerik Document Processing portal: 
http://feedback.telerik.com/Project/184/Feedback/Details/190117 
Please use the new item for commenting, voting and subscribing instead of this one.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments