Exemple #1
0
        public static void CopyElements(this XWPFDocument doc, XWPFDocument srcDoc)
        {
            var position = doc.Paragraphs.Count;

            foreach (var element in srcDoc.BodyElements)
            {
                switch (element.ElementType)
                {
                case BodyElementType.PARAGRAPH:
                    var srcPr = (XWPFParagraph)element;
                    doc.CopyStyle(srcDoc, srcDoc.GetStyles().GetStyle(srcPr.StyleID));
                    doc.CreateParagraph();
                    doc.SetParagraph(srcPr, position);
                    break;
                }
                position++;
            }
        }