Migradoc圆角

时间:2014-07-04 16:50:36

标签: c# pdfsharp migradoc

如何摆放桌子的圆角?我正在使用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");

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

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

显示如何使用属性的代码段:

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;
}