RadFlowDocument 调整 table 单元格宽度

RadFlowDocument adjust table cell width

我使用的是 Telerik 2016 Q1、Visual Studio 2013、visual basic 和 MVC。我正在尝试使用 RadFlowDocument 生成 pdf。我的 pdf 包含一个 table,其中包括员工姓名的一行,后跟分配给该员工的每个项目的一行。此信息会重复,因此会有一行包含名称,然后是 4 行包含项目,然后是另一个名称,然后是更多项目。

员工姓名所在的行应跨越 table 的宽度,并具有不同的背景颜色,以使其突出显示。我试过调整 tableCell.PrefferedWidth,但这似乎对输出没有任何影响。

这是创建 table:

的循环
    For i As Integer = 0 To numberOfSubordinates - 1
        Dim currentSubordinate As Subordinate = neededInformation.Subordinates(i)

        Dim employeeNameRow As TableRow = itemTable.Rows.AddTableRow()
        Dim employeeNameCell As TableCell = employeeNameRow.Cells.AddTableCell()
        employeeNameCell.Blocks.AddParagraph.Inlines.AddRun(currentSubordinate.Name)
        employeeNameCell.Shading.BackgroundColor = cellBackground
        employeeNameCell.PreferredWidth = New TableWidthUnit(150)

        For j As Integer = 0 To currentSubordinate.Items.Count - 1
            Dim row As TableRow = itemTable.Rows.AddTableRow()

            Dim itemTypeCell As TableCell = row.Cells.AddTableCell()
            Dim manufacturerCell As TableCell = row.Cells.AddTableCell()
            Dim modelCell As TableCell = row.Cells.AddTableCell()
            Dim locationCell As TableCell = row.Cells.AddTableCell()
            Dim serialNumberCell As TableCell = row.Cells.AddTableCell()
            Dim tagNumberCell As TableCell = row.Cells.AddTableCell()

            Dim currentItem = currentSubordinate.Items(j)

            itemTypeCell.Blocks.AddParagraph().Inlines.AddRun(currentItem.ItemType)
            manufacturerCell.Blocks.AddParagraph.Inlines.AddRun(currentItem.Manufacturer)
            modelCell.Blocks.AddParagraph.Inlines.AddRun(currentItem.Model)
            locationCell.Blocks.AddParagraph.Inlines.AddRun(currentItem.Location)
            serialNumberCell.Blocks.AddParagraph.Inlines.AddRun(currentItem.SerialNumber)
            tagNumberCell.Blocks.AddParagraph.Inlines.AddRun(currentItem.MCSCTagNumber)
        Next

    Next

如何扩展员工姓名行以使姓名不换行,并且背景颜色会延长行的长度?

调整cell.ColumnSpan。在这个 table 的情况下,它有 6 列,为了有一个横跨整个 table 的行,调整应该是:employeeNameCell.ColumnSpan = 6.