如何设置表格的宽度

本文关键字:表格 设置 何设置 | 更新日期: 2023-09-27 18:31:49

Table table = new Table ();        
TableRow row1 = new TableRow();
TableRow row2 = new TableRow();
TableCell cell1_1 = new TableCell { RowSpan = 2,  };           
TableCell cell1_2 = new TableCell
{
    Text = string.Format("<h4>{0}</h4><br />{1}<br/>",
        product.ProductName, "Product No:" + product.Id),
    HorizontalAlign = HorizontalAlign.Left,
};
TableCell cell1_3 = new TableCell { Text = "Unit Price<hr/>"};  
TableCell cell1_4 = new TableCell { Text = "Quantity<hr/>" };            
TableCell cell1_5 = new TableCell { Text = "Product Total<hr/>"};
TableCell cell1_6 = new TableCell();
TableCell cell2_1 = new TableCell();
TableCell cell2_2 = new TableCell { Text = "Rs " + product.Price};
TableCell cell2_3 = new TableCell();            
TableCell cell2_4 = new TableCell { Text = "Rs " + (order.Quantity * product.Price) };
TableCell cell2_5 = new TableCell();

如何设置此表的宽度?当我尝试表时。威特德它不起作用

如何设置表格的宽度

Table table = new Table();
table.Width=new Unit("100%");

 table.Width = new Unit("70px");

Unit属于System.Web.UI.WebControls的地方

表。宽度 = 新单位("25%")

为我工作。