How to get paragraph underline style

i try “paragraph.getListLabel().getFont().getUnderline()” to get underline is 0,but i set underline is double,i try “paragraph.getListLabel().getFont().getColor” to get paragraph color is ok. so how to get paragraph underline style?

@maochen

To retrieve the underline style of a paragraph in Aspose.Words, you should access the font properties of the runs within the paragraph. The method you attempted, paragraph.getListLabel().getFont().getUnderline(), may not yield the expected results because it targets the list label font rather than the font of the paragraph text itself.

Instead, you can iterate through the runs in the paragraph and check their underline properties. Here’s an example of how to do this in C#:

using Aspose.Words;
using Aspose.Words.Paragraphs;

Document doc = new Document("YourDocument.docx");
Paragraph paragraph = doc.FirstSection.Body.FirstParagraph;

// Iterate through each run in the paragraph
foreach (Run run in paragraph.Runs)
{
    // Check the underline style of each run
    Underline underlineStyle = run.Font.Underline;
    Console.WriteLine($"Run text: {run.Text}, Underline style: {underlineStyle}");
}

In this code, we access the first paragraph of the document and iterate through its runs. For each run, we print the text and its underline style. This way, you can determine the underline style applied to the text in the paragraph.

If you need to check for a specific underline style (like double underline), you can add a condition to filter the results accordingly.

Feel free to adjust the document path and the paragraph selection as per your requirements.

If you have any further questions or need additional assistance, let me know!