Migradoc添加水平线

rik*_*ket 13 c# migradoc

如何在Migradoc中添加一个简单的水平线,以便将该行上方的内容与该行下方的内容分开?

第1段

第2段


第3段

等等

Je *_*not 12

您可以为段落或表添加边框.

对于您的示例,您可以为段落2添加底部边框或向段落3添加顶部边框或在它们之间添加新段落并设置顶部或底部边框.


vic*_*car 7

从这个回购

        var hr = doc.AddStyle("HorizontalRule", "Normal");
        var hrBorder = new Border();
        hrBorder.Width = "1pt";
        hrBorder.Color = Colors.DarkGray;
        hr.ParagraphFormat.Borders.Bottom = hrBorder;
        hr.ParagraphFormat.LineSpacing = 0;
        hr.ParagraphFormat.SpaceBefore = 15;
Run Code Online (Sandbox Code Playgroud)

  • 我还必须添加一行myParagraph.Format = hr.ParagraphFormat.Clone(); (3认同)

cwa*_*ort 5

游戏迟到了,但这里是一个附加到现有段落格式的示例,而不是像上面的答案那样覆盖,保留已经定义的格式:

Paragraph p = new Paragraph();

p.Format.Alignment = ParagraphAlignment.Center;
//...any other formats needed
p.Format.Borders.Bottom = new Border() { Width = "1pt", Color = Colors.DarkGray };
Run Code Online (Sandbox Code Playgroud)