15

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

第 1 段

第 2 段


第 3 段

ETC

4

3 回答 3

14

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

对于您的示例,您可以为第 2 段添加下边框或为第 3 段添加上边框或在它们之间添加新段落并设置上边框或下边框。

于 2013-08-26T16:10:05.397 回答
8

从这个回购

        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;
于 2015-06-18T05:39:41.790 回答
3

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

Paragraph p = new Paragraph();

p.Format.Alignment = ParagraphAlignment.Center;
//...any other formats needed
p.Format.Borders.Bottom = new Border() { Width = "1pt", Color = Colors.DarkGray };
于 2019-12-11T20:44:45.290 回答