【问题标题】:iTextSharp table.SpacingBefore not workingiTextSharp table.SpacingBefore 不工作
【发布时间】:2013-03-07 15:32:39
【问题描述】:

我有一个表格,我试图将其从 pdf 文档的上边距缩小大约 20/30 浮点 (f)。我想稍微缩小一点的原因是因为我的 pdf 文档的边缘有一个矩形边框。

PdfPTable table = new PdfPTable(1);
table.SpacingBefore = 20f;
table.SpacingAfter = 20f;
table.TotalWidth = 700f;
table.LockedWidth = true;

table.SpacingAfter 工作得很好,但 table.SpacingBefore 不行,我的桌子只是坐在顶部边缘,根本不会留出空间/填充。

【问题讨论】:

    标签: c# pdf itextsharp itext


    【解决方案1】:

    查看answer here,它表示如果将表格作为文档中的第一项插入,则SpacingBefore 将被忽略,这是设计使然。根据帖子,解决方案是添加一个零前导的空段落。

    【讨论】:

    • 在答案中添加一些示例代码会有所帮助,链接可能会关闭然后没有示例。
    • 段落应该是new Paragraph(" ") 女巫不同于new Paragraph(string.Empty)
    猜你喜欢
    • 1970-01-01
    • 2015-08-01
    • 1970-01-01
    • 2017-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-12
    相关资源
    最近更新 更多