单元格文字ju中问题
已经设定某一列单元格为leftcenter 然后 怎莫设置 这一列的某一个单元格rightcenter 。Public Function CellRange(ByVal maxRows As Integer) As Boolean
sprDetailedSchedule.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom
Dim rng As CellRange = sprDetailedSchedule.GetCellRange(maxRows, 2, maxRows, 4)
rng.Style = sprDetailedSchedule.Styles("FirstCustomStyle")
rng.StyleNew.TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.LeftCenter
sprDetailedSchedule.MergedRanges.Add(rng)
Dim omg As CellRange = sprDetailedSchedule.GetCellRange(maxRows, 5, maxRows, 7)
omg.Style = sprDetailedSchedule.Styles("FirstCustomStyle")
omg.StyleNew.TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.RightCenter
sprDetailedSchedule.MergedRanges.Add(omg)
End Function
sprDetailedSchedule 为我的表格名称。
您好,这个可以换种方式实现,因为在列上设置是针对整列的,我们可以在C1GridView1_RowDataBound,中对特定单元格来设置TextAlign
protected void C1GridView1_RowDataBound(object sender, C1GridViewRowEventArgs e)
{
for (int i = 0; i < e.Row.Cells.Count; i++)//获取总列数
{
//如果是数据行则添加title
if (e.Row.RowType == C1GridViewRowType.DataRow)
{//设置title为gridview的head的text
e.Row.Cells.Attributes.Add("title", "提示信息如下:"+"\n"+C1GridView1.HeaderRow.Cells.Text.ToString().Trim() + ":"+ e.Row.Cells.Text.ToString().Trim());
if (e.Row.Cells.Text == "22")//针对单元格为22的设置居中
{
e.Row.Cells.Attributes.Add("style", "text-align: center");
}
}
}
}
页:
[1]