SetStyle

GridCell.SetStyle method

为单元格设置样式。 为提高性能,实现“SetStyle”方法, 不实现“样式”属性。

public void SetStyle(Style value)
范围类型描述
styleStyle要设置的样式。

例子

[C#]
Style style = sheet.GetCell(0, 0).GetStyle();
style.CellLocked = true;
style.VAlignment = VerticalAlignmentType.Top;
...
sheet.GetCell(0, 0).SetStyle(style);

[Visual Basic]
Dim style As Style =  sheet.GetCell(0,0).GetStyle() 
style.CellLocked = True
style.VAlignment = VerticalAlignmentType.Top
...
sheet.GetCell(0, 0).SetStyle(style)

也可以看看