【问题标题】:MigraDoc table with rounded corners带圆角的 MigraDoc 表
【发布时间】:2014-07-04 16:50:35
【问题描述】:

如何为桌子设置圆角?我正在使用 c# 和 MigraDoc。

MigraDoc.DocumentObjectModel.Tables.Table myTable = section.AddTable();
myTable.Borders.Visible = true;
MigraDoc.DocumentObjectModel.Tables.Column myColumn = myTable.AddColumn();
MigraDoc.DocumentObjectModel.Tables.Row myRow = myTable.AddRow();
myRow[0].AddParagraph("Some text");

【问题讨论】:

    标签: c# pdfsharp migradoc


    【解决方案1】:

    【讨论】:

    • 能否请您在此处更新,如果有人在 Migradoc 中实现了这一点。
    【解决方案2】:

    MigraDoc 表格单元格具有RoundedCorner 属性。
    我现在没有时间创建一个功能齐全的示例,但是 AIUI 你必须在顶部和底部添加虚拟行以及在左侧和右侧添加虚拟列,以便为圆角腾出空间。您必须设置单元格阴影才能看到圆角的效果。而且这些圆角很可能仅适用于 PDF,不适用于 RTF。

    显示如何使用属性的代码 sn-p:

    public static void SetRoundedCorners(Table table)
    {
        int rowCount = table.Rows.Count;
        int colCount = table.Columns.Count;
    
        if (rowCount < 2 || colCount < 2)
            return;
    
        table.Rows[0].Cells[0].RoundedCorner = RoundedCorner.TopLeft;
        table.Rows[0].Cells[colCount - 1].RoundedCorner =  RoundedCorner.TopRight;
        table.Rows[rowCount - 1].Cells[colCount - 1].RoundedCorner =  RoundedCorner.BottomRight;
        table.Rows[rowCount - 1].Cells[0].RoundedCorner =  RoundedCorner.BottomLeft;
    }
    

    【讨论】:

      猜你喜欢
      • 2020-05-08
      • 2016-07-12
      • 2011-04-05
      • 2020-12-30
      • 2019-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多