Migra Doc PDF页脚样式

时间:2017-10-15 12:03:14

标签: c# pdf report migradoc

我有一个页脚位于每页的左右两侧。页脚中的每个段落包含2行文本。我想要的是在页脚的两行文本之间添加一条水平线。

以下是添加页脚的代码。

 private void AddFooterData(Section section) {
        // add prepared by. approved by etc

        var rightFooterSection = new Paragraph {
            Format = { Alignment = ParagraphAlignment.Right }
        };
        rightFooterSection.AddText("Prepared By Eng: " + _preparedBy);
        rightFooterSection.AddLineBreak();

        rightFooterSection.AddText("Page ");
        rightFooterSection.AddPageField();
        rightFooterSection.AddText(" / ");
        rightFooterSection.AddNumPagesField();
        section.Footers.Primary.Add(rightFooterSection);

        var date = DateTime.Now.ToString("yyyy/MM/dd");
        var leftSection = new Paragraph {
            Format = { Alignment = ParagraphAlignment.Left }
        };
        leftSection.AddText("Approved By: " + _approvedBy);

        leftSection.AddLineBreak();
        leftSection.AddText(date);
        section.Footers.Primary.Add(leftSection);

    }

这是一张所需页脚结果的图片。

enter image description here

1 个答案:

答案 0 :(得分:1)

我自己搞定了这个。 创建一个包含2列宽度与页面相同的列的表, 创建2行 在顶行,将底部边框设置为可见。 对齐每行中的文本,因此左列将左对齐,右列将对齐

INSERT INTO table2 (firstname, lastname)
SELECT firstname, lastname
FROM table1
-- WHERE <conditions>