コード例 #1
0
 public ParagraphStyle(
     LineAlignment lineAlignment,
     ParagraphSpacing spacing)
 {
     this.LineAlignment = lineAlignment;
     this.Spacing       = spacing;
 }
コード例 #2
0
ファイル: Conversions.cs プロジェクト: proxoft/DocxToPdf
        public static ParagraphSpacing Override(
            this ParagraphSpacing defaultSpacing,
            Word.SpacingBetweenLines spacingBetweenLines,
            params Word.SpacingBetweenLines[] prioritized)
        {
            StringValue before = null;
            StringValue after  = null;
            StringValue line   = null;
            EnumValue <Word.LineSpacingRuleValues> lineRule = null;

            foreach (var spacing in new[] { spacingBetweenLines }.Union(prioritized).Where(s => s != null))
            {
                before   = before ?? spacing.Before;
                after    = after ?? spacing.After;
                line     = line ?? spacing.Line;
                lineRule = lineRule ?? spacing.LineRule;

                if (before != null && after != null && line != null)
                {
                    break;
                }
            }

            var bf = before?.ToPoint() ?? defaultSpacing.Before;
            var af = after?.ToPoint() ?? defaultSpacing.After;
            var ls = line?.GetLineSpacing(lineRule) ?? defaultSpacing.Line;

            return(new ParagraphSpacing(ls, bf, af));
        }
コード例 #3
0
ファイル: Conversions.cs プロジェクト: proxoft/DocxToPdf
        public static ParagraphSpacing Spacing(
            this Word.Paragraph paragraph,
            ParagraphSpacing defaultParagraphSpacing)
        {
            var spacingXml = paragraph.ParagraphProperties?.SpacingBetweenLines;

            return(spacingXml.ToParagraphSpacing(defaultParagraphSpacing));
        }
コード例 #4
0
ファイル: Conversions.cs プロジェクト: proxoft/DocxToPdf
        public static ParagraphSpacing ToParagraphSpacing(
            this Word.SpacingBetweenLines spacingXml,
            ParagraphSpacing ifNull)
        {
            if (spacingXml == null)
            {
                return(ifNull);
            }

            var before = spacingXml.Before.ToPoint();
            var after  = spacingXml.After.ToPoint();
            var line   = spacingXml.GetLineSpacing();

            return(new ParagraphSpacing(line, before, after));
        }