Class GridTableItemStyle

GridTableItemStyle class

Inherited from System.Web.UI.WebControls.TableItemStyle. Encapsulates the styles of a WebCell.

public class GridTableItemStyle : TableItemStyle, ISerializable

Constructors

NameDescription
GridTableItemStyle()Default constructor.

Properties

NameDescription
BackImageAttributes { get; set; }Background image attributes.
BackImageUrl { get; set; }Background image url.
BottomBorderStyle { get; set; }Specifies the style of the cell’s bottom border.
Custom { get; set; }Gets or sets the custom format, null or empty string means no custom format.
IndentLevel { get; set; }Gets or sets indent level.
IsLocked { get; set; }Gets or sets a value indicating whether a cell can be modified or not when its worksheet is protected. When its worksheet is protected and IsLocked is true, the cell can not be edit. When its worksheet is protected and IsLocked is false, the cell can be edit.
LeftBorderStyle { get; set; }Specifies the style of the cell’s left border.
NumberType { get; set; }Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.
QuotePrefix { get; set; }Indicates whether the cell’s value starts with single quote mark.
RightBorderStyle { get; set; }Specifies the style of the cell’s right border.
RotationAngle { get; set; }Gets or sets Rotation attribute.
TopBorderStyle { get; set; }Specifies the style of the cell’s top border.

Methods

NameDescription
override AddAttributesToRender(HtmlTextWriter, WebControl)Internal use only. Implementation method Do not call this method directly.
override CopyFrom(Style)Copies from another style object.
override GetHashCode()Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
override MergeWith(Style)Merges with another style object.

Examples

[C#]
        GridWeb GridWeb1 = new GridWeb();
        GridWorksheetCollection sheets = GridWeb1.WorkSheets;

        GridWorksheet sheet = sheets.Add("demo1");

         sheet.Cells[0,0].PutValue("Demo Text");
         GridTableItemStyle style = sheet.Cells[0, 0].Style;
        
        style.Font.Size = FontUnit.Point(72);
     	style.Wrap = false;

     	style.BackColor = Color.Gray;
     	style.BorderStyle = BorderStyle.Solid;
     	style.BorderWidth = Unit.Pixel(1);
     	style.BorderColor = Color.Silver;
        style.RightBorderStyle.BorderColor = Color.Black;
     	style.RightBorderStyle.BorderStyle = BorderStyle.Solid;
     	style.RightBorderStyle.BorderWidth = Unit.Pixel(1);
     	style.BottomBorderStyle.BorderColor = Color.Black;
     	style.BottomBorderStyle.BorderStyle = BorderStyle.Solid;
     	style.BottomBorderStyle.BorderWidth = Unit.Pixel(1);
         sheet.Cells[0, 0].Style=style;
[Visual Basic]
Dim sheets As GridWorksheetCollection =  GridWeb1.WorkSheets
Dim sheet As GridWorksheet =  sheets(sheets.Add(__0__))

Dim cell As GridCell =  sheet.Cells(0,0)
cell.StringValue = "Demo Text"

Dim style As GridTableItemStyle = cell.GetStyle()
style.Font.Size = FontUnit.Point(72)
style.Wrap = False

style.BackColor = Color.Gray
style.BorderStyle = BorderStyle.Solid
style.BorderWidth = Unit.Pixel(1)
style.BorderColor = Color.Silver

style.RightBorderStyle.BorderColor = Color.Black
style.RightBorderStyle.BorderStyle = BorderStyle.Solid
style.RightBorderStyle.BorderWidth = Unit.Pixel(1)
style.BottomBorderStyle.BorderColor = Color.Black
style.BottomBorderStyle.BorderStyle = BorderStyle.Solid
style.BottomBorderStyle.BorderWidth = Unit.Pixel(1)
cell.SetStyle(style)

See Also