Please check the following analysis results:
1. Theme attribute “Name” is optional. It can be changed to any value or removed and document can still properly be opened, and theme name and formatting is preserved. But documentation does not describe that this attribute is optional.
2. Theme name of document opened in MS-Word is depended from theme file name (file with “thmx” extension). Theme name changes (“Name” attribute value) in packet of the document does not affect to displayed theme name in Ms-Word.
3. Probably the appropriate theme file is determined by equality of some child theme elements like “clrScheme”, “fmtScheme” and “fontScheme” in theme file and packet of the document. While theme search is running client files have higher priority than default theme files. If we create two files in Ms-Word with the same default theme and save theme from first file as custom user theme to special theme folder then second file after re-open has custom user theme name.
4. Automation tool “Microsoft.Office.Tools.Word” does not provide the ability to get and set theme name.
So, “Name” theme attribute does not define document theme name. Theme name in Ms-Word displayed as theme file name (file with “thmx” extension). Appropriate theme file defines by comparison formatting parameters in packet of the document and theme file stored at user device. Comparison algorithm have to be checked and updated.
So, the possible solutions are:
1. Sharing for read and write “Name” theme attribute. Name of the appropriate property in object model should describe that it is not actual theme name. It is just user defined identifier. But if client want to define actual theme name this method is incorrect;
2. Implement “thmx” file parsing to object model. Provide method that search appropriate “thmx” file in specified path and return its name. Result of the method is a displayed theme name and this behavior is identical to Ms-Word.
3. Implement ability 1 and 2;
Please let us know which option fits best to your needs.