Free Support Forum - aspose.com

How do I tell the difference between direct formatting and formatting applied via styles?

I have a style named "Heading 1" that is bold.

I also have a paragraph styled as "Heading 1", but which somebody has ALSO made italic.

Is there any easy way to differentiate between the styles on this paragraph that are and are not part of the "Heading 1" style?

I realise I could look for differences between the paragraphs styling and the named styles styling, but this will potentially be a very common occurrence within our application and I'm looking for the most efficient way to do it.

Any help much appreciated.

Hi Alex,


Thanks for your inquiry. The formatting applied to text in a Microsoft Word document can come from many different sources. A useful thing to note about the Aspose.Words’ API is that querying direct formatting (Run.getFont, Paragraph.getParagraphFormat) will normally return the “calculated” formatting value based on all direct formatting, styles and document defaults etc. Therefore, using the direct formatting properties are the best way to find the visible formatting of the content.

There is no direct way to find out this difference. Maybe you can get style and compare its formatting with your direct run formatting. But if Run has the same direct formatting as style, there will not be any difference.