/// <summary>
        /// Creates a style.
        /// </summary>
        /// <param name="ps">The paragraph style.</param>
        /// <param name="styleId">The style id.</param>
        /// <param name="styleName">The style name.</param>
        /// <param name="basedOnStyleId">The based on style id.</param>
        /// <param name="nextStyleId">The next style id.</param>
        /// <param name="isDefault"><c>true</c> if the style is default.</param>
        /// <param name="isCustomStyle"><c>true</c> if the style is a custom style.</param>
        /// <returns>The <see cref="Style" />.</returns>
        private static Style CreateStyle(
            ParagraphStyle ps,
            string styleId,
            string styleName,
            string basedOnStyleId,
            string nextStyleId,
            bool isDefault     = false,
            bool isCustomStyle = true)
        {
            // todo: add font to FontTable?
            var rPr = new StyleRunProperties();

            // http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.color.aspx
            var color = new Color {
                Val = ps.TextColor.ToString().Trim('#').Substring(2)
            };

            rPr.AppendChild(color);

            // http://msdn.microsoft.com/en-us/library/cc850848.aspx
            rPr.AppendChild(new RunFonts {
                Ascii = ps.FontFamily, HighAnsi = ps.FontFamily
            });
            rPr.AppendChild(new FontSize {
                Val = new StringValue((ps.FontSize * 2).ToString(CultureInfo.InvariantCulture))
            });
            rPr.AppendChild(
                new FontSizeComplexScript
            {
                Val = new StringValue((ps.FontSize * 2).ToString(CultureInfo.InvariantCulture))
            });

            if (ps.Bold)
            {
                rPr.AppendChild(new Bold());
            }

            if (ps.Italic)
            {
                rPr.AppendChild(new Italic());
            }

            var pPr = new StyleParagraphProperties();
            var spacingBetweenLines2 = new SpacingBetweenLines
            {
                After    = string.Format(CultureInfo.InvariantCulture, "{0}", ps.SpacingAfter * 20),
                Before   = string.Format(CultureInfo.InvariantCulture, "{0}", ps.SpacingBefore * 20),
                Line     = string.Format(CultureInfo.InvariantCulture, "{0}", ps.LineSpacing * 240),
                LineRule = LineSpacingRuleValues.Auto
            };
            var indentation = new Indentation
            {
                Left  = string.Format(CultureInfo.InvariantCulture, "{0}", ps.LeftIndentation * 20),
                Right = string.Format(CultureInfo.InvariantCulture, "{0}", ps.RightIndentation * 20)
            };
            var contextualSpacing1 = new ContextualSpacing();

            pPr.AppendChild(spacingBetweenLines2);
            pPr.AppendChild(contextualSpacing1);
            pPr.AppendChild(indentation);

            // StyleRunProperties styleRunProperties7 = new StyleRunProperties();
            // RunFonts runFonts8 = new RunFonts() { Ascii = "Verdana", HighAnsi = "Verdana" };
            // Color color7 = new Color() { Val = "000000" };

            // styleRunProperties7.AppendChild(runFonts8);
            // styleRunProperties7.AppendChild(color7);

            // http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.style.aspx
            var style = new Style
            {
                Default     = new OnOffValue(isDefault),
                CustomStyle = new OnOffValue(isCustomStyle),
                StyleId     = styleId,
                Type        = StyleValues.Paragraph
            };

            style.AppendChild(new Name {
                Val = styleName
            });
            if (basedOnStyleId != null)
            {
                style.AppendChild(new BasedOn {
                    Val = basedOnStyleId
                });
            }

            //// var rsid = new Rsid();

            // style.AppendChild(rsid);
            var primaryStyle = new PrimaryStyle();

            style.AppendChild(primaryStyle);
            if (nextStyleId != null)
            {
                style.AppendChild(new NextParagraphStyle {
                    Val = nextStyleId
                });
            }

            style.AppendChild(rPr);
            style.AppendChild(pPr);
            return(style);
        }
        /// <summary>
        /// Creates a style.
        /// </summary>
        /// <param name="ps">The paragraph style.</param>
        /// <param name="styleId">The style id.</param>
        /// <param name="styleName">The style name.</param>
        /// <param name="basedOnStyleId">The based on style id.</param>
        /// <param name="nextStyleId">The next style id.</param>
        /// <param name="isDefault"><c>true</c> if the style is default.</param>
        /// <param name="isCustomStyle"><c>true</c> if the style is a custom style.</param>
        /// <returns>The <see cref="Style" />.</returns>
        private static Style CreateStyle(
            ParagraphStyle ps,
            string styleId,
            string styleName,
            string basedOnStyleId,
            string nextStyleId,
            bool isDefault = false,
            bool isCustomStyle = true)
        {
            // todo: add font to FontTable?
            var rPr = new StyleRunProperties();

            // http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.color.aspx
            var color = new Color { Val = ps.TextColor.ToString().Trim('#').Substring(2) };
            rPr.AppendChild(color);

            // http://msdn.microsoft.com/en-us/library/cc850848.aspx
            rPr.AppendChild(new RunFonts { Ascii = ps.FontFamily, HighAnsi = ps.FontFamily });
            rPr.AppendChild(new FontSize { Val = new StringValue((ps.FontSize * 2).ToString(CultureInfo.InvariantCulture)) });
            rPr.AppendChild(
                new FontSizeComplexScript
                    {
                        Val = new StringValue((ps.FontSize * 2).ToString(CultureInfo.InvariantCulture))
                    });

            if (ps.Bold)
            {
                rPr.AppendChild(new Bold());
            }

            if (ps.Italic)
            {
                rPr.AppendChild(new Italic());
            }

            var pPr = new StyleParagraphProperties();
            var spacingBetweenLines2 = new SpacingBetweenLines
                {
                    After = string.Format(CultureInfo.InvariantCulture, "{0}", ps.SpacingAfter * 20),
                    Before = string.Format(CultureInfo.InvariantCulture, "{0}", ps.SpacingBefore * 20),
                    Line = string.Format(CultureInfo.InvariantCulture, "{0}", ps.LineSpacing * 240),
                    LineRule = LineSpacingRuleValues.Auto
                };
            var indentation = new Indentation
                {
                    Left = string.Format(CultureInfo.InvariantCulture, "{0}", ps.LeftIndentation * 20),
                    Right = string.Format(CultureInfo.InvariantCulture, "{0}", ps.RightIndentation * 20)
                };
            var contextualSpacing1 = new ContextualSpacing();

            pPr.AppendChild(spacingBetweenLines2);
            pPr.AppendChild(contextualSpacing1);
            pPr.AppendChild(indentation);

            // StyleRunProperties styleRunProperties7 = new StyleRunProperties();
            // RunFonts runFonts8 = new RunFonts() { Ascii = "Verdana", HighAnsi = "Verdana" };
            // Color color7 = new Color() { Val = "000000" };

            // styleRunProperties7.AppendChild(runFonts8);
            // styleRunProperties7.AppendChild(color7);

            // http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.style.aspx
            var style = new Style
                {
                    Default = new OnOffValue(isDefault),
                    CustomStyle = new OnOffValue(isCustomStyle),
                    StyleId = styleId,
                    Type = StyleValues.Paragraph
                };

            style.AppendChild(new Name { Val = styleName });
            if (basedOnStyleId != null)
            {
                style.AppendChild(new BasedOn { Val = basedOnStyleId });
            }

            //// var rsid = new Rsid();

            // style.AppendChild(rsid);
            var primaryStyle = new PrimaryStyle();
            style.AppendChild(primaryStyle);
            if (nextStyleId != null)
            {
                style.AppendChild(new NextParagraphStyle { Val = nextStyleId });
            }

            style.AppendChild(rPr);
            style.AppendChild(pPr);
            return style;
        }