如何在Migradoc中添加一条简单的水平线,以便将线上内容与线下内容分隔开?
段落1
段落2
段落3
等等
您可以为段落或表格添加边框。
就您的示例而言,您可以为第2段添加底部边框,或为第3段添加顶部边框,或在它们之间添加一个新段落,并设置顶部或底部边框。
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;
Paragraph p = new Paragraph();
p.Format.Alignment = ParagraphAlignment.Center;
//...any other formats needed
p.Format.Borders.Bottom = new Border() { Width = "1pt", Color = Colors.DarkGray };