如何在rdlc报表的TablixCell中生成子行?

时间:2019-03-13 14:19:19

标签: c# rdlc

我正在尝试在TablixCell中生成具有两列的子行。我在TablixCell中一起需要两个项目。一个是图像,另一个是文本。图像和文本不能同时在TablixCell中显示。我以为TablixCell中有一个嵌套的TablixRow,但是它声明了TablixCell has invalid child element 'TablixRow'

string strTableRow = "";
strTableRow = @"<TablixRow> 
    <Height>0.6cm</Height> 
    <TablixCells>";
for (int i = 0; i < columns.Length; i++)
{
    ColumnCell = columns[i].ColumnCell;
    padding = ColumnCell.Padding;
    padding.Left = 0;
    padding.Right = 0;
    string tempXmlString = "";

    if (ColumnCell.Name.Contains("FooColumn"))
    {
        string strRuleName = @"<TablixRow> 
                        <Height>0.6cm</Height> 
                        <TablixCells>";
        strRuleName += @"<TablixCell> 
                <CellContents> 
                " + GenerateImageBox("imgCell_" + table.ReportName + "_" + ColumnCell.Name, " = IIF(Fields!RuleName.Value = \"0\",\"ImgSLF\" ,\"ImgSLF\")", 0.16667, 0.375, 1, true) + @" 
                </CellContents> 
                </TablixCell>";

        strRuleName += @"<TablixCell> 
                <CellContents> 
                " + GenerateTextBox("txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" 
                </CellContents> 
                </TablixCell>";

        strRuleName += @"</TablixCells></TablixRow>";

        tempXmlString = strRuleName;
    }
    else
        tempXmlString = GenerateTextBox("txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding);

    if (!ColumnCell.Name.Contains("FooColumn"))
    {
        strTableRow += @"<TablixCell> 
                    <CellContents> 
                    " + tempXmlString + @" 
                    </CellContents> 
                    </TablixCell>";
    }
    else
    {
        strTableRow += @"<TablixCell> 
       " + tempXmlString + @"
        </TablixCell>";
    }
}
strTableRow += @"</TablixCells></TablixRow>";
return strTableRow;

0 个答案:

没有答案