示例#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);
            }
        }
示例#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);
        }