html table nowrap,HtmlTableCell.NoWrap 属性 (System.Web.UI.HtmlControls) | Microsoft Docs

本文档详细介绍了 HtmlTableCell 类的 NoWrap 属性,该属性用于指示单元格中的文本是否在达到单元格末尾时自动换行。默认值为 false,即文本会自动换行。示例代码展示了如何在服务器端通过编程方式设置此属性,以控制 HtmlTable 控件中单元格的文本布局。
摘要由CSDN通过智能技术生成

获取或设置一个值,该值指示当到达单元格末尾时,由 HtmlTableCell 类的实例所表示的单元格中的文本是否自动继续在下一行显示。Gets or sets a value indicating whether the text in a cell represented by an instance of the HtmlTableCell class automatically continues on the next line when it reaches the end of the cell.

public:

property bool NoWrap { bool get(); void set(bool value); };

public bool NoWrap { get; set; }

[System.ComponentModel.TypeConverter(typeof(System.Web.UI.MinimizableAttributeTypeConverter))]

public bool NoWrap { get; set; }

member this.NoWrap : bool with get, set

[]

member this.NoWrap : bool with get, set

Public Property NoWrap As Boolean

属性值

如果在单元格中文本不自动换行,则为 true;否则,为 false。true if the text does not automatically wrap in the cell; otherwise, false. 默认值是 false。The default value is false.

示例

下面的代码示例演示如何使用属性以 NoWrap 编程方式控制文本是否换行到控件的单元格中 HtmlTable 。The following code example demonstrates how to use the NoWrap property to programmatically control whether the text wraps in the cells of an HtmlTable control.

/p>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

void Button_Click(Object sender, EventArgs e)

{

// Iterate through the rows of the table.

for (int i = 0; i <= Table1.Rows.Count - 1; i++)

{

// Iterate through the cells of a row.

for (int j = 0; j <= Table1.Rows[i].Cells.Count - 1; j++)

{

// Update the properties of each cell.

Table1.Rows[i].Cells[j].Align = AlignSelect.Value;

Table1.Rows[i].Cells[j].NoWrap = Convert.ToBoolean(NoWrapSelect.Value);

Table1.Rows[i].Cells[j].VAlign = VAlignSelect.Value;

}

}

}

HtmlTableCell Example

HtmlTableCell Example

style="border-width: 1; border-color: Black">

Here is some content for Cell 1.

Here is some content for Cell 2.

Here is some content for Cell 3.

Here is some content for Cell 4.


Select the display settings for the cells in the table:

Align:

runat="server">

Left

Center

Right

NoWrap:

runat="server">

True

False

VAlign:

runat="server">

Top

Middle

Bottom

value="Generate Table"

onserverclick="Button_Click"

runat="server"/>

/p>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim i As Integer

Dim j As Integer

' Iterate through the rows of the table.

For i = 0 To Table1.Rows.Count - 1

' Iterate through the cells of a row.

For j = 0 To Table1.Rows(i).Cells.Count - 1

' Update the properties of each cell.

Table1.Rows(i).Cells(j).Align = AlignSelect.Value

Table1.Rows(i).Cells(j).NoWrap = Convert.ToBoolean(NoWrapSelect.Value)

Table1.Rows(i).Cells(j).VAlign = VAlignSelect.Value

Next j

Next i

End Sub

HtmlTableCell Example

HtmlTableCell Example

style="border-width: 1; border-color: Black">

Here is some content for Cell 1.

Here is some content for Cell 2.

Here is some content for Cell 3.

Here is some content for Cell 4.


Select the display settings for the cells in the table:

Align:

runat="server">

Left

Center

Right

NoWrap:

runat="server">

True

False

VAlign:

runat="server">

Top

Middle

Bottom

value="Generate Table"

onserverclick="Button_Click"

runat="server"/>

注解

使用 NoWrap 属性来指定或确定由类的实例表示的单元格中的文本在 HtmlTableCell 到达单元格末尾时是否自动在下一行上继续。Use the NoWrap property to specify or determine whether the text in a cell represented by an instance of the HtmlTableCell class automatically continues on the next line when it reaches the end of the cell.

适用于

另请参阅

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值