Free Support Forum - aspose.com

How to read bullets lists of text from word document in Asp.net

Hi Team,
How to read a list of bullets and carriage return character from word document.
if I use MS word style of bullets in a word,
I cannot find it with run text,
How can I read bullets in program in asp .net.
Examples Text:
The Page Header contains the following:

• Operator: Operator
• Timebase: _DIONEX_HPLC_PHX
• Sequence: CARAWAY LC 20190523
• Page 1-1
• Today’s date in mm/dd/yyyy format
• Time printed in HH:MM <AM/PM>

Please find the attachment for sample word document text image for your reference.

Sample Word image.png (122.6 KB)

@thiru1711

Please use Paragraph.IsListItem property to check either paragraph is an item in a bulleted or numbered list.

To get the string representation of list label, please use ListLabel.LabelString property. Please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + "iniput.docx");
doc.UpdateListLabels();
int listParaCount = 1;

foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>())
{
    // Find if we have the paragraph list. In our document our list uses plain arabic numbers,
    // which start at three and ends at six.
    if (paragraph.ListFormat.IsListItem)
    {
        Console.WriteLine("Paragraph #{0}", listParaCount);

        // This is the text we get when actually getting when we output this node to text format. 
        // The list labels are not included in this text output. Trim any paragraph formatting characters.
        String paragraphText = paragraph.ToString(SaveFormat.Text).Trim();
        Console.WriteLine("Exported Text: " + paragraphText);

        ListLabel label = paragraph.ListLabel;
        // This gets the position of the paragraph in current level of the list. If we have a list with multiple level then this
        // will tell us what position it is on that particular level.
        Console.WriteLine("Numerical Id: " + label.LabelValue);

        // Combine them together to include the list label with the text in the output.
        Console.WriteLine("List label combined with text: " + label.LabelString + " " + paragraphText);

        listParaCount++;
    }
}