Free Support Forum - aspose.com

Unable to get Theme name from .docx files

Is it possible to retrieve the theme name from .docx files?

I see we can get the Theme object, but using it we can only get the Fonts / Colors associated to the Theme, but not the name of the theme (For example, “Office” / “Facet” / “Ion” etc.)

Any help is appreciated. Thanks.

Hi Madhes,


Thanks for your inquiry. Could you please attach your sample input document here for testing? We will investigate the scenario on our end and provide you more information.

Best regards,

Thanks for the reply.
Attaching the Word document on which the “Fancy” theme is applied.

Hi Madhes,

Thanks for your inquiry. We have logged your requirement in our issue tracking system as WORDSNET-13207. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for any inconvenience.

Best regards,

Hi Madhes,


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.

Best regards,

A post was split to a new topic: Provide API to get set Theme Name