Aspose Deep Clone of Styles from one document to another

Hi,
How can you perform a deep clone of a Style from Document A to a new Document B? I basically want the new custom style from Document A to appear in Document B Style Gallery with all the Formatting preserved.
I’ve tried creating a new Style on the target document using the same Style Type and Style Name, then performing a Property copy, but I cannot seem to set the List, ListFormating and the Tab Stops. There seems to be no Setters on the List and List Formatting, whereas the Tabs Stops you can add to the collection a new Tab Stop but they fail to come out in when rendered in Word.
I’m using Aspose .Net 11.7
Kind regards
Russell

Hi Russell,

Thanks for your inquiry. First I would suggest you please upgrade to the latest version of Aspose.Words i.e. 11.9.0 that includes a very handy method named AddCopy that you can use to copy styles between documents. Here is how you can copy style from one document into a different document.

// This is the style in the source
document to copy to the destination document.
Style srcStyle = srcDoc.Styles[StyleIdentifier.Heading1];
// Change the font of the heading style to red.
srcStyle.Font.Color = Color.Red;
// The AddCopy method can be used to copy a style from a different document.
Style newStyle = dstDoc.Styles.AddCopy(srcStyle);

I hope, this helps.

Best Regards,