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.CopyStylesFromTemplate(source);
target.Save("D:/Test/Import Styles/MyDocAspose.docx");
And here is the test filesCopyStylesFromTemplate.zip (37.4 KB)
*Be noted that in MS Word, style names are not changed after the import.