Free Support Forum -

Style name changed after using CopyStyleFromTemplate() to import/update styles in .NET

I’ve got a problem with the style names with alias are changed after using Aspose to update styles from a template (.dotx).
The names with alias are changed in this case:
Let’s say I have a style name which is “Style1,Z style,A style” in my word document. And I have a style template (.dotx) which containing the same style name in there. After processing the CopyStyleFromTemplate function, the style name in the result is changed from “Style1,Z style,A style” to “Style1,A style,Z style”.
I expect to have the same name (“Style1,Z style,A style”) as before, no need to re-ordering the alias part in style names.

Here is my codes (Aspose.Word V21.3):

myWord.Document source = new myWord.Document("D:/Test/Import Styles/MyTemplate.dotx");
myWord.Document target = new myWord.Document("D:/Test/Import Styles/MyDocAspose.docx");
target.Save("D:/Test/Import Styles/MyDocAspose.docx");

And here is the test (37.4 KB)

*Be noted that in MS Word, style names are not changed after the import.


We have managed to reproduce the same issue and logged it in our issue tracking system as WORDSNET-22088. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like