We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document.getStyles() would not giving - separated names

Hi there,
If the document contains comma separated style names - and we are trying some thing like:
StyleCollection sampleDocStyles = sampleDoc.getStyles();
for (int i = 0; i < sampleDocStyles.getCount(); i++) {
Style sampleStyle = sampleDocStyles.get(i);

If the name in word document is “Normal + 10 pt,Black,Bold,Justified,Pattern: Clear (White)”. The API is saying the name as “Normal + 10 pt”.
Another example is “Header,Header first page” would be read as “Header”.

After the comma (including comma), it is ignoring the name.

Attaching the document that has these styles.

Checked with MS word manage styles + import style. It is giving full name with commas and all.


Hi Praneeth,

Thanks for your inquiry.

fact, comma separated style name is cosmetic convention used in Microsoft Word’s user
interface style names. In this case, the actual style’s name is “Header”, after that goes a comma-separated list of style “aliases”. So, you
can access this style both as sampleDoc.getStyles().get(“Header”) as well as sampleDoc.getStyles().get(“Header first page”).

In case you have further inquires or need any help, please let us know.

Thanks Tahir for the information.

Is there a way to copy these list of alias style names too along with the style?
I mean the imported style would look like the same as in source document, in our case - “Header,Header first page”.


Hi Praneeth,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support to get/set Style alias at the moment. However, we have already logged this feature request as WORDSNET-8464 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-8464) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.