Exemplo n.º 1
0
        /// <summary>
        /// 导出Excel格式化数据
        /// </summary>
        /// <param name="e"></param>
        private void SettlementRecordGrid_ExportToExcelCustomCell(DevExpress.Export.CustomizeCellEventArgs e)
        {
            int rowIndex = e.DataSourceRowIndex;

            if (rowIndex < 0 || rowIndex >= this.bsEntity.Count)
            {
                return;
            }

            if (e.ColumnFieldName == "DepartmentId")
            {
                var department = this.departments.Find(r => r.Id == e.Value.ToString());
                if (department == null)
                {
                    return;
                }

                e.Handled = true;
                e.Value   = department.Name;
            }
            if (e.ColumnFieldName == "EnergyType")
            {
                int type;
                if (!Int32.TryParse(e.Value.ToString(), out type))
                {
                    return;
                }

                e.Handled = true;
                e.Value   = ((EnergyType)type).DisplayName();
            }
        }
Exemplo n.º 2
0
 void exportOptions_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs ea)
 {
     if (ea.AreaType == DevExpress.Export.SheetAreaType.Header)
     {
         ea.Formatting.BackColor  = System.Drawing.Color.FromArgb(1, 0, 98, 158);
         ea.Formatting.Font.Color = System.Drawing.Color.WhiteSmoke;
         ea.Handled = true;
     }
 }
Exemplo n.º 3
0
 private void Options_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs e)
 {
     if (e.ColumnFieldName == "OT_Time")
     {
         //return;
         e.Formatting.NumberFormat = XlNumberFormat.General;
         e.Handled = true;
     }
 }
 void exportOptions_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs ea)
 {
     if (ea.AreaType != DevExpress.Export.SheetAreaType.Header && ea.ColumnFieldName == "UnitPrice")
     {
         if (Convert.ToDecimal(ea.Value) > 15)
         {
             ea.Formatting.BackColor = System.Drawing.Color.Yellow;
         }
         else
         {
             ea.Formatting.BackColor = System.Drawing.Color.Green;
         }
         ea.Handled = true;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 导出Excel格式化
        /// </summary>
        /// <param name="e"></param>
        private void GroupItemGrid_ExportToExcelCustomCell(DevExpress.Export.CustomizeCellEventArgs e)
        {
            int rowIndex = e.DataSourceRowIndex;

            if (rowIndex < 0 || rowIndex >= this.bsEntity.Count || e.DocumentRow <= 0)
            {
                return;
            }

            var item   = this.bsEntity[rowIndex] as GroupItem;
            var entity = CallerFactory <IGroupService> .Instance.GetItemEntity(item);

            if (e.ColumnFieldName == "EntityId")
            {
                e.Value   = entity.Name;
                e.Handled = true;
            }
        }
    void exportOptions_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs ea)
    {
        if (ea.ColumnFieldName != "UnitsOnOrder" || ea.AreaType != DevExpress.Export.SheetAreaType.DataArea)
        {
            return;
        }
        int cellValue = 0;

        if (int.TryParse(ea.Value.ToString(), out cellValue) && cellValue == 0)
        {
            ea.Formatting.BackColor  = Color.Salmon;
            ea.Formatting.Font.Color = Color.Blue;
            ea.Formatting.Font.Bold  = true;
        }
        else
        {
            ea.Formatting.BackColor = Color.LightBlue;
        }
        ea.Handled = true;
    }
Exemplo n.º 7
0
        static void op_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs ea)
        {
            DateTime testDT = new DateTime();

            if (ea.Value is DateTime)
            {
                if (ea.Value == null)
                {
                    ea.Formatting.FormatType = DevExpress.Utils.FormatType.None;
                    ea.Value   = string.Empty;
                    ea.Handled = true;
                }
                else if ((DateTime)ea.Value == testDT || ea.Value.ToString().Contains("1900"))
                {
                    ea.Formatting.FormatType = DevExpress.Utils.FormatType.None;
                    ea.Value   = string.Empty;
                    ea.Handled = true;
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 导出到Excel格式化数据
        /// </summary>
        /// <param name="e"></param>
        private void MeasureRecordGrid_ExportToExcelCustomCell(DevExpress.Export.CustomizeCellEventArgs e)
        {
            int rowIndex = e.DataSourceRowIndex;

            if (rowIndex < 0 || rowIndex >= this.bsEntity.Count)
            {
                return;
            }

            if (e.ColumnFieldName == "DepartmentId")
            {
                var department = this.departments.Find(r => r.Id == e.Value.ToString());
                if (department == null)
                {
                    return;
                }

                e.Handled = true;
                e.Value   = department.ShortName;
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 导出Excel格式化事件
 /// </summary>
 /// <param name="e"></param>
 private void op_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs e)
 {
     ExportToExcelCustomCell?.Invoke(e);
 }