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

Free Support Forum - aspose.com

How to get first paragraph of document that is not empty and contains no field using Java

Dear Team,

I am using aspose word java , i want get first paragraph of the document.

Condition of getting first paragraph:

  1. First paragraph should not be empty paragraph
    2)First paragraph should not field codes

Thanks in advance,
Kesavaraman 02_chapter.zip (37.7 KB)
4_Chapter.zip (57.3 KB)

@keshav07

In your case, we suggest you following solution.

  1. Please use Body.Paragraphs property to get the collection of paragraph in a section.
  2. Iterate over paragraph nodes and check either it is empty or not. You can use Paragraph.HasChildNodes to check either is is empty or not.
  3. To check if paragraph has field, you can use Paragraph.Range.Fields.Count property.

Hope this helps you.