mayankgaur.in@gmail.com

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Get lists in word using c# #4316

    Hi Eric,
    I need to fetch all lists from documents, with their parents. For Instance ,

    Companies List:-
    1. ABC
    2. XYZ
    3. KLM.
    Places to visit :-
    1. International Space Station(ISS)
    2. Poles of Earth

    I need to make them sort like,
    Public Class Parent
    {

    public string Name{get;set;}
    public HashSet<Children>childrens{get;set;}
    }
    HashSet<Parent> parentModel= new HashSet<Parent>();
    using (WordprocessingDocument doc = WordprocessingDocument.Open(docxFile, true))
    {
    Body body = doc.MainDocumentPart.Document.Body;
    foreach (Paragraph paragraph in paragraphs)
    {

    parent.Name= paragraph.InnerText;
    parentlist.Add(parent);
    model.parents = parentlist;
    }
    }
    //Thats how I got parent But I want child like that
    Parent[0] Companies List
    Child[0]ABC
    Child[1]XYZ
    Child[2]KLM
    Parent[1] Places to visit
    Child[0]International Space Station(ISS)
    Child[1]Poles of Earth

Viewing 1 post (of 1 total)