Example #1
0
 //DAR FORMATO A COLUMNAS
 void op_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs ea)
 {
     if (ea.ColumnFieldName == "X")
     {
         ea.Formatting.BackColor = Color.Red;
         ea.Handled = true;
     }
 }
Example #2
0
        void op_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs e)
        {
            string           _mark         = (grvCTCongNo.GetRowCellValue(e.RowHandle, "TenKhach") ?? string.Empty).ToString();
            int              _LoaiGiaoDich = int.Parse((grvCTCongNo.GetRowCellValue(e.RowHandle, "LoaiGiaoDich") ?? -1).ToString());
            XlCellFormatting formatting    = new XlCellFormatting();

            formatting.Font = new XlFont();

            if (e.Value is DateTime && (DateTime)e.Value == testDT || e.Value == null)
            {
                e.Formatting.FormatType = DevExpress.Utils.FormatType.None;
                e.Value = string.Empty;
            }

            if (e.AreaType == SheetAreaType.Header || _mark == "TỔNG CỘNG:")
            {
                formatting.Font.Bold = true;
                formatting.Fill      = XlFill.SolidFill(Color.DarkSeaGreen);
                e.Handled            = true;
                e.Formatting.CopyFrom(formatting, FormatType.None);
            }

            if (e.ColumnFieldName == "LoaiGiaoDich")
            {
                switch (_LoaiGiaoDich)
                {
                case 0:
                case 1:
                    formatting.Fill = XlFill.SolidFill(Color.FromArgb(237, 105, 28));
                    break;

                case 2:
                    formatting.Fill = XlFill.SolidFill(Color.Lime);
                    break;

                case 6:
                case 7:
                    formatting.Fill = XlFill.SolidFill(Color.FromArgb(250, 52, 131));
                    break;

                case 8:
                case 9:
                    formatting.Fill = XlFill.SolidFill(Color.FromArgb(232, 72, 72));
                    break;

                case 10:
                    formatting.Fill = XlFill.SolidFill(Color.Gold);
                    break;
                }
                e.Formatting.CopyFrom(formatting, FormatType.None);
            }

            e.Handled = true;
        }
Example #3
0
 private void Options_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs e)
 {
     if (e.ColumnFieldName != "SoTienGui")
     {
         return;
     }
     e.Formatting.NumberFormat = "@";
     //or
     //e.Formatting.NumberFormat = XlNumberFormat.Text;
     e.Handled = true;
 }