'How to get list from docx file?

How to determine whether a list is bulleted or numbered? I use OpenXML

In general, what will be the list determines NumberingDefinitionsPart, I thought to find out the Numbering of a certain element, but this method did not work

I am processing the list in the recommended way, but I need to know which way it is

    `public void ParagraphHandle(Elements.Paragraph paragraph, StringBuilder text)
    {
        var docPart = paragraph.DocumentPart;
        var element = paragraph.Element;

        var r = element.Descendants<Numbering>().ToArray();

        var images = GetImages(docPart, element);

        if (images.Count > 0)
        {
            foreach (var image in images)
            {
                if (image.Id != null)
                {
                    string filePath = _saveResources.SaveImage(image);
                    _handler.ImageHandle(filePath, text);
                }
            }

            return;
        }

        var paragraphProperties = element.GetFirstChild<ParagraphProperties>();

        var numberingProperties = paragraphProperties?.GetFirstChild<NumberingProperties>();

        if (numberingProperties != null)
        {
            var numberingId = numberingProperties.GetFirstChild<NumberingId>()?.Val?.Value;

            if (numberingId != null && !paragraph.IsList)
            {
                text.AppendLine("<ul>");
                paragraph.IsList = true;

                paragraph.List = new List();

                _htmlGenerator.GenerateList(paragraph, text);
            }
            else
            {
                _htmlGenerator.GenerateList(paragraph, text);
            }
        }
        else
        {
            if (paragraph.IsList)
            {
                text.AppendLine("</ul>");
                paragraph.IsList = false;
            }

            _handler.ParagraphHandle(element, text);
        }
    }`


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source