public WordParagraphDef AddParagraph(string text, ContentStyle style = null)
        {
            var result = new WordParagraphDef(text, style);

            AddItem(result);
            if (style != null)
            {
                result.Style = style;
            }
            result.AddText(text);
            return(result);
        }
        private WordParagraphDef AddParagraph(WordGroupDef wordDoc, XmlNode node)
        {
            _paragraphCount++;
            var oldStyle = new ContentStyle(_style);

            try
            {
                SetTextStyle(node);
                SetSectionStyle(node);

                var pd = new WordParagraphDef(String.Empty, _style);
                wordDoc.AddItem(pd);
                if (node.NodeType == XmlNodeType.Text)
                {
                    pd.AddItem(new WordParagraphTextDef(node.InnerText));
                }
                else if (node.NodeType == XmlNodeType.Element)
                {
                    if (!node.HasChildNodes)
                    {
                        pd.AddItem(new WordParagraphTextDef(node.InnerText)
                        {
                            Style = _style
                        });
                    }
                    else
                    {
                        foreach (XmlNode child in node.ChildNodes)
                        {
                            if (child.NodeType == XmlNodeType.Element &&
                                String.Equals(child.Name, "repeat", StringComparison.OrdinalIgnoreCase))
                            {
                                AddRepeatSectoin(pd, child);
                            }
                            else
                            {
                                AddText(pd, child);
                            }
                        }
                    }
                }
                return(pd);
            }
            finally
            {
                _style.Assign(oldStyle);
                _paragraphCount--;
            }
        }