예제 #1
0
    protected void RadGrid1_ExcelMLWorkBookCreated(object sender, GridExcelMLWorkBookCreatedEventArgs e)
    {
        foreach (RowElement row in e.WorkBook.Worksheets[0].Table.Rows)
        {
            row.Cells[0].StyleValue = "Style1";
        }

        StyleElement style = new StyleElement("Style1");

        style.InteriorStyle.Pattern = InteriorPatternType.Solid;
        style.InteriorStyle.Color   = System.Drawing.Color.LightGray;
        e.WorkBook.Styles.Add(style);
    }
예제 #2
0
        protected void grd_Show_ExcelMLWorkBookCreated(object sender, GridExcelMLWorkBookCreatedEventArgs e)
        {
            int r = 0;

            foreach (RowElement row in e.WorkBook.Worksheets[0].Table.Rows)
            {
                for (int i = 0; i < row.Cells.Count; i++)
                {
                    if (r != 0)
                    {
                        if (r % 2 == 0)
                        {
                            row.Cells[i].StyleValue = "Style1";
                        }
                        else
                        {
                            row.Cells[i].StyleValue = "Style2";
                        }
                    }
                    else
                    {
                        row.Cells[i].StyleValue = "styleHeader";
                    }
                }
                r++;
            }
            StyleElement styleHeader = new StyleElement("styleHeader");

            styleHeader.InteriorStyle.Pattern = InteriorPatternType.Solid;
            styleHeader.InteriorStyle.Color   = System.Drawing.Color.White;
            styleHeader.FontStyle.FontName    = "Tahoma";
            styleHeader.FontStyle.Bold        = true;
            styleHeader.AlignmentElement.HorizontalAlignment = HorizontalAlignmentType.Center;
            e.WorkBook.Styles.Add(styleHeader);
            StyleElement style = new StyleElement("Style1");

            style.InteriorStyle.Pattern = InteriorPatternType.Solid;
            style.InteriorStyle.Color   = System.Drawing.Color.FromArgb(162, 226, 255);
            style.FontStyle.FontName    = "Tahoma";
            style.AlignmentElement.HorizontalAlignment = HorizontalAlignmentType.Center;
            e.WorkBook.Styles.Add(style);
            StyleElement style2 = new StyleElement("Style2");

            style2.AlignmentElement.HorizontalAlignment = HorizontalAlignmentType.Center;
            style2.InteriorStyle.Pattern = InteriorPatternType.Solid;
            style2.InteriorStyle.Color   = System.Drawing.Color.FromArgb(217, 243, 255);
            style2.FontStyle.FontName    = "Tahoma";
            e.WorkBook.Styles.Add(style2);
        }
예제 #3
0
 protected void radGridtarh_ExcelMLWorkBookCreated(object sender, GridExcelMLWorkBookCreatedEventArgs e)
 {
     makeExcel(e);
 }