简体   繁体   English

如何在后面的代码中计数Html cell?

[英]How Can I count Html cell' in code behind?

i'm using method to bind data from database to fill in PdfPTable and i use this method to add data by cell 我正在使用从数据库绑定数据以填充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);

How Can I count Html cell's in code behind from PdfPTable using ASP.net 我如何使用ASP.net从PdfPTable中计数Html单元格中的代码

尝试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM