我正在尝试使用MigraDoc创建PDF文档,并且当表包含左缩进时,我遇到表边框问题.
我将数据传递给以下函数来呈现表.
public void AddTable(int _iNumberOfColumns, double leftInd)
{
table = section.AddTable();
if (leftInd != 0d)
{
table.Format.LeftIndent = leftInd;
}
for (int i = 0; i < _iNumberOfColumns; i++)
{
Column col = table.AddColumn();
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的方法中,我传递参数的double值leftInd.我认为,这是问题的原因.
添加单元格的代码如下.我正在通过bool变量来判断是否需要显示单元格边框...(要添加一行我只是调用row = table.AddRow();)
public void AddColumn(int _iCellNum, int iColspan, double dCellWidthInPt, System.Drawing.Color color, bool bTopBorder, bool bLeftBorder, bool bBottomBorder, bool bRightBorder)
{
cell = row.Cells[_iCellNum];
if (iColspan > 0)
{
cell.MergeRight = iColspan-1;
for (int i = 0; …Run Code Online (Sandbox Code Playgroud)