How to get the character style attached with linked style

Hi Support,

any way to get the character style attached with linked style?

-Aspose.words for java

If Heading 1 is a linked style - Heading 1 Char is character style associated with it.

I need Heading 1 Char style if I have Heading 1 style in hand.

This message was posted using Email2Forum by Imran Rafique

To add some detail-

Hi Praneeth,

Thanks for your inquiry. Please use Style.LinkedStyleName property to get the name of the Style linked to this one. This property returns Empty string if no styles are linked.

If you face any issue, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.

Is it available in Aspose.Words for Java?

It seems like not available in 14.7.0 but present in latest version.

We’re really not in the position of changing the version now. We need linked style however.

Can you help us via writing some code for getting linked style some how?

Some sort of -
public String getLinkedStyleName(Style name) // takes style name such ‘Heading 1’ and provides the character style associated with it.

Thanks.

Hi Praneeth,

Thanks for your inquiry. Unfortunately, there is no workaround available to get linked style name. Please use the latest version of Aspose.Words for Java 14.11.0 and use Style.getLinkedStyleName method to achieve your requirements.

Please let us know if you have any more queries.

Hi Tahir,
Thanks for looking into this. However just to let you guys know that we can do it using a dummy document object and try applying style to it using addCopy and it would add two styles in document and from these two one is our linked style. We thought there could be some less expensive way to do so.

Thanks.

Hi Praneeth,

Thanks for sharing the detail. Yes, using addCopy method, you can workaround the shared issue. This method copies a style along with linked character style.

Please let us know if you have any more queries.