Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何计算Html单元格';代码隐藏?_C#_Asp.net_Itextsharp - Fatal编程技术网

C# 如何计算Html单元格';代码隐藏?

C# 如何计算Html单元格';代码隐藏?,c#,asp.net,itextsharp,C#,Asp.net,Itextsharp,我正在使用方法绑定数据库中的数据以填充PdfPTable 我使用这个方法按单元格添加数据 dfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3")); cell.BackgroundColor = Color.GRAY; cell.Colspan = 3; cell.Ho

我正在使用方法绑定数据库中的数据以填充PdfPTable 我使用这个方法按单元格添加数据

        dfPTable table = new PdfPTable(3);
        PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3"));
        cell.BackgroundColor = Color.GRAY;
        cell.Colspan = 3;
        cell.HorizontalAlignment = Element.ALIGN_CENTER;           
        cell.Border = PdfBorderArray.BOOLEAN;
        cell.BorderColor = Color.RED;
        table.AddCell(cell);
如何使用ASP.net计算PdfPTable中代码隐藏的Html单元格?请尝试以下操作:

var noOfCells = table.Rows.Select(r => r.GetCells()).Count();
试试这个:

var noOfCells = table.Rows.Select(r => r.GetCells()).Count();

您是否试图在单元格上设置索引或计算您添加了多少单元格或完全不同的内容?是的,我尝试只计算有多少单元格,以便我可以在其他方法中使用它为这些单元格进行自定义您是否试图在单元格上设置索引或计算您添加了多少单元格或完全不同的内容?是的试着数一数有多少个单元格,这样我就可以在其他方法中使用它来定制这些单元格