public static void SetIndent(ParagraphProperties pp, int?leftChars, FirstLineOrHangingChars firstLineOrhangingChars)
        {
            var indent = new Indentation();

            if (leftChars != null)
            {
                indent.LeftChars = leftChars.Value;
            }

            if (firstLineOrhangingChars != null)
            {
                switch (firstLineOrhangingChars.Floh)
                {
                case FirstLineOrHanging.FirstLine:
                    indent.FirstLineChars = firstLineOrhangingChars.Chars;
                    break;

                case FirstLineOrHanging.Hanging:
                    indent.HangingChars = firstLineOrhangingChars.Chars;
                    break;

                default:
                    throw new InvalidEnumArgumentException(firstLineOrhangingChars.Floh.ToString());
                }
            }

            OpenXmlElementHelper.SetChild(pp, indent);
        }
        public static void SetParagraphProperties(ParagraphProperties p, int?leftChars, FirstLineOrHangingChars firstLineOrhangingChars, int?spaceBetweenLines, JustificationValues?jv)
        {
            var oxes = new List <OpenXmlElement>();

            if (leftChars != null || firstLineOrhangingChars != null)
            {
                var indent = new Indentation();

                if (leftChars != null)
                {
                    indent.LeftChars = leftChars.Value;
                }

                if (firstLineOrhangingChars != null)
                {
                    switch (firstLineOrhangingChars.Floh)
                    {
                    case FirstLineOrHanging.FirstLine:
                        indent.FirstLineChars = firstLineOrhangingChars.Chars;
                        break;

                    case FirstLineOrHanging.Hanging:
                        indent.HangingChars = firstLineOrhangingChars.Chars;
                        break;

                    default:
                        throw new InvalidEnumArgumentException(firstLineOrhangingChars.Floh.ToString());
                    }
                }

                oxes.Add(indent);
            }

            if (spaceBetweenLines.HasValue)
            {
                oxes.Add(new SpacingBetweenLines {
                    LineRule = LineSpacingRuleValues.Auto, Line = spaceBetweenLines.Value.ToString()
                });
            }

            if (jv.HasValue)
            {
                oxes.Add(new Justification {
                    Val = jv
                });
            }

            OpenXmlElementHelper.SetChild(p, new ParagraphProperties(oxes));
        }