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

Free Support Forum - aspose.com

Issue to get italic format

Hello,

I have an issue to find lines with italic format.

I used the method :
paragraph.getParagraphFormat().getStyle().getFont().getItalic()

Paragraph is a com.aspose.words.Paragraph object.

The issue is that this method return “false” all the time.

Could you please, say me what is wrong ?

@cbarbet.cstb,

Thanks for your inquiry. Please note that formatting is applied on a few different levels. For example, let’s consider formatting of simple text. Text in documents is represented by Run element and a Run can only be a child of a Paragraph. You can apply formatting

  1. to Run nodes by using Character Styles e.g. a Glyph Style,
  2. to the parent of those Run nodes i.e. a Paragraph node (possibly via paragraph Styles)
  3. you can also apply direct formatting to Run nodes by using Run attributes (Font). In this case the Run will inherit formatting of Paragraph Style, a Glyph Style and then direct formatting.

Please try Run.Font.Italic property. Hope this helps you.