How to find horizontal line in Word document using .NET

I have word document, it contain 2 horizontal lines which is using draw line or shift + _, so i need to find that lines are there in the document or not?Lines.PNG (12.9 KB)

@knr

If your document contains underscore (shift + _), you can check it using Run.Text property. If the text has underline font formatting, you can check it using Run.Font.Underline.

If you face any issue while using Aspose.Words, please ZIP and attach your input Word document and expected output. We will then provide you more information on it.

Need to verify the two lines are exact place or not?HIGHLIGHTS OF PRESCRIBING INFORMATION_HL.zip (23.9 KB)

A horizontal line must separate HL( HIGHLIGHTS OF PRESCRIBING INFORMATION) from the Table of Contents (TOC). A horizontal line must separate the TOC from the FPI( FULL PRESCRIBING INFORMATION )
Ex:
HL
dkjfhdjkfhdkj
dsfdskjfkldjfdsl. Ending with Revised: 06/2017


TOC
dfdksfjdsklfjdsklfjks
dskfjdskljflkdsjfdlsfj
skdfjldskjfdsklfjldskfj
kjdsfkldsjflkdsjfkdslfjds. Ends with *Sections or subsections omitted from the full prescribing information are not

listed.


FPI
dsjfkldjfkldsjfkldsjflds
sdfjkdsljfkldsjfdskljfdskl
ldjflkdsjfkldsjflsdjf

@knr

In your document, the line is Shape of type Line. You can get it as shown below using Shape.ShapeType property.

The line can be horizontal rule in the document. You can check it using Shape.IsHorizontalRule property.

Document doc = new Document(MyDir + "in.docx");

foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true))
{
    Console.WriteLine(shape.IsHorizontalRule);
    Console.WriteLine(shape.ShapeType);
}

Thank you very much…