Exemple #1
0
        /// <summary>
        /// Create Paragraph tree from file
        /// </summary>
        private void ParseParagraphs()
        {
            Paragraphs = new ParagrafCollection(doc);
            Segment           segItem;
            SegmentCollection segCollection;
            Paragraf          parItem;


            int count = doc.MainDocumentPart.Document.Body.Elements <Paragraph>().Count();

            for (int i = 0; i < count; i++)
            {
                Paragraph p = doc.MainDocumentPart.Document.Body.Elements <Paragraph>().ElementAt(i);
                segCollection = new SegmentCollection(p);

                int partCount = p.Elements <Run>().Count();
                for (int j = 0; j < partCount; j++)
                {
                    Run tr = p.Elements <Run>().ElementAt(j);
                    segItem = new Segment(tr);
                    segCollection._add(segItem);
                }
                parItem = new Paragraf(p, segCollection);
                Paragraphs._add(parItem);
            }
        }
Exemple #2
0
        private Paragraf _newParagraf(Paragraph p)
        {
            Segment           segItem;
            Paragraf          parItem;
            SegmentCollection segCol = new SegmentCollection(p);

            int partCount = p.Elements <Run>().Count();

            for (int j = 0; j < partCount; j++)
            {
                Run tr = p.Elements <Run>().ElementAt(j);
                segItem = new Segment(tr);
                segCol._add(segItem);
            }
            parItem = new Paragraf(p, segCol);
            return(parItem);
        }
Exemple #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="p">Reference to OpenXML Paragraph</param>
 /// <param name="segCollection">Segment Collection</param>
 public Paragraf(Paragraph p, SegmentCollection segCollection)
 {
     this.p        = p;
     this.Segments = segCollection;
 }