コード例 #1
0
        protected void btnApplyBorderStyles_Click(object sender, EventArgs e)
        {
            // ExStart:ApplyBorderStyles
            // Accessing the reference of the worksheet that is currently active and resize first row and column
            WebWorksheet sheet = GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex];

            sheet.Cells.Clear();

            sheet.Cells.SetColumnWidth(0, new Unit(200, UnitType.Point));
            sheet.Cells.SetRowHeight(0, new Unit(50, UnitType.Point));

            // Accessing a specific cell of the worksheet
            WebCell cell = sheet.Cells["A1"];

            Aspose.Cells.GridWeb.TableItemStyle style = cell.GetStyle();

            // Setting the border style to Solid
            style.BorderStyle = BorderStyle.Solid;

            // Setting the border width to 2 pixels
            style.BorderWidth = new Unit(2, UnitType.Pixel);

            // Setting the border color to Blue
            style.BorderColor = Color.Blue;

            // Set the cell style
            cell.SetStyle(style);
            // ExEnd:ApplyBorderStyles
        }
コード例 #2
0
        protected void btnApplyFontStyles_Click(object sender, EventArgs e)
        {
            // ExStart:ApplyFontStyles
            // Accessing the reference of the worksheet that is currently active and resize first row and column
            WebWorksheet sheet = GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex];

            sheet.Cells.Clear();

            sheet.Cells.SetColumnWidth(0, new Unit(200, UnitType.Point));
            sheet.Cells.SetRowHeight(0, new Unit(50, UnitType.Point));
            // Accessing a specific cell of the worksheet
            WebCell cell = sheet.Cells["A1"];

            // Inserting a value in cell A1
            cell.PutValue("Aspose.Cells.GridWeb");

            Aspose.Cells.GridWeb.TableItemStyle style = cell.GetStyle();

            // Setting the font size to 12 points
            style.Font.Size = new FontUnit("12pt");

            // Setting font style to Bold
            style.Font.Bold = true;

            // Setting foreground color of font to Blue
            style.ForeColor = Color.Blue;

            // Setting background color of font to Aqua
            style.BackColor = Color.Aqua;

            // Setting the horizontal alignment of font to Center
            style.HorizontalAlign = HorizontalAlign.Center;

            // Set the cell style
            cell.SetStyle(style);
            // ExEnd:ApplyFontStyles
        }