C# 圆角桌
如何设置桌子的圆角?我用的是c#和docC# 圆角桌,c#,pdfsharp,migradoc,C#,Pdfsharp,Migradoc,如何设置桌子的圆角?我用的是c#和doc MigraDoc.DocumentObjectModel.Tables.Table myTable = section.AddTable(); myTable.Borders.Visible = true; MigraDoc.DocumentObjectModel.Tables.Column myColumn = myTable.AddColumn(); MigraDoc.DocumentObjectModel.Tables.Row myRow = my
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");
PdfSharp可以做到这一点。我不确定,医生
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");
doc表格单元格有一个
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;
}
publicstaticvoidsetroundedcorners(表格)
{
int rowCount=table.Rows.Count;
int colCount=table.Columns.Count;
if(行计数<2 | |列计数<2)
返回;
table.Rows[0]。单元格[0]。RoundedCorner=RoundedCorner.TopLeft;
table.Rows[0]。单元格[colCount-1]。RoundedCorner=RoundedCorner.TopRight;
table.Rows[rowCount-1]。单元格[colCount-1]。RoundedCorner=RoundedCorner.BottomRight;
table.Rows[rowCount-1]。单元格[0]。RoundedCorner=RoundedCorner.BottomLeft;
}
如果有人在Doc中实现了这一点,请在此更新。