DevExpress.XtraReports:XRPivotGrid 笔记

简介: 1.DevExpress.XtraReports:XrPivotGrid 显示时间为"0"的 格式问题: 把xrPivotGridField1的SummaryType改为"Max"或者"Min"; 另外在Cell格式化时间默认日期时间一起显示的,如果只想显示为Time(不显示日期部门)只需...
1.

DevExpress.XtraReports:XrPivotGrid 显示时间为"0"的 格式问题:

 把xrPivotGridField1的SummaryType改为"Max"或者"Min";

 

另外在Cell格式化时间默认日期时间一起显示的,

如果只想显示为Time(不显示日期部门)只需设置xrPivotGridField1属性中的CellFormat为DateTime "t"

如果只想显示为Date(不显示时间部分)只需设置xrPivotGridField1属性中的CellFormat为DateTime "d"

 

以下设置只影响GrandTotal(总计),不影响小计

       this.pivotGridField12.GrandTotalCellFormat.FormatString = "t";
       this.pivotGridField12.GrandTotalCellFormat.FormatType = DevExpress.Utils.FormatType.DateTime;

 

 2.

          //this.xrPivotGrid1.OptionsView.ShowColumnHeaders = false;//显示列头
            this.xrPivotGrid1.OptionsView.ShowDataHeaders = false;//显示数据头
            this.xrPivotGrid1.OptionsView.ShowColumnTotals = false;//显示横向分组小计
            //this.xrPivotGrid1.OptionsView.ShowColumnGrandTotals = false;//显示横向总计
           this.xrPivotGrid1.OptionsView.ShowRowGrandTotals = false;//显示纵向总计
          //  xrPivotGrid1.ShowColumnGrandTotalHeader = false;//横向总计总表头文本("Grand Total")

       
            this.xrPivotGridField5.Options.ShowGrandTotal = false;            //不做总计显示
            this.xrPivotGridField6.Options.ShowTotal = false;        //不做小计显示

3.添加自定义总计列(未测试)

 
 
if  (xrPivotGridField5.Area  ==  PivotArea.ColumnArea)
                         {           
xrPivotGridField5.CustomTotals.Clear();          
xrPivotGridField5.CustomTotals.Add(DevExpress.Data.PivotGrid.PivotSummaryType.Average);
xrPivotGridField5.CustomTotals.Add(DevExpress.Data.PivotGrid.PivotSummaryType.Max);
xrPivotGridField5.TotalsVisibility 
=  PivotTotalsVisibility.CustomTotals;
                         }

 4.对齐方式(这里pivotGridControl使用Winform的控件)

 

   //其他cell对齐方式类似
            this.pivotGridControl2.Appearance.FieldValueTotal.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;//小计标题居中对齐
            this.pivotGridControl2.Appearance.FieldValueGrandTotal.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;//合计标题居中对齐

            this.pivotGridControl2.Appearance.FieldValue.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;//字段列居中对齐
  5.
  //关于统计标题的修改
        private void pivotGridControl2_FieldValueDisplayText(object sender, DevExpress.XtraPivotGrid.PivotFieldDisplayTextEventArgs e)
        {           
            if (e.ValueType == DevExpress.XtraPivotGrid.PivotGridValueType.GrandTotal)//总计
            {
                if (e.IsColumn &&e.DisplayText.Trim()=="Grand Total")//第一层列总计标题
                {
                    e.DisplayText = "总计";
                }else
                if (e.IsColumn)//其他层列总计标题
                {
                    e.DisplayText = e.DisplayText + "总计";
                }
                else if (e.IsColumn == false && e.DisplayText.Trim() == "Grand Total")//第一层行总计标题
                {
                    e.DisplayText = "总计";
                }
                else//这种情况似乎不会发生
                {
                    e.DisplayText = "";
                }
            }
            else if (e.ValueType == DevExpress.XtraPivotGrid.PivotGridValueType.Total)//小计
            {
                if (e.IsColumn && e.Value != null)//第一层列小计标题
                {
                   // e.DisplayText = e.DisplayText.Replace("Total", "").Trim() + "小计";
                    e.DisplayText = e.Value + "小计";
                }
                else if(e.IsColumn )//其他层列小计标题
                {
                    e.DisplayText = e.DisplayText.Replace("Total", "").Trim() + "合计";
                }
            }
            else if (e.ValueType == DevExpress.XtraPivotGrid.PivotGridValueType.CustomTotal)//其他自定义合计类型
            {

            }
        }

 

 

 

 

 

 

 

目录
相关文章
|
开发框架 移动开发
DevExpress的xtraMessageBox汉化
原文:DevExpress的xtraMessageBox汉化 项目使用的界面库是DevExpress 相当好用,不过里面弹出对话框XtraMessageBox的按钮都是英文的, 可能会对用户造成困扰, 网上搜了搜,找到一种比较简单的方法解决这个问题,如下: 首先:定义一个继承自Localizer的类 using DevExpress.
1454 0
|
C++
DevExpress学习02——DevExpress 14.1的汉化
汉化资源: 汉化补丁:dxKB_A421_DXperience_v14.1_(2014-06-09):http://www.t00y.com/file/86576990 汉化工具:DXperienceUniversal-14.
1377 0
|
测试技术
DevExpress学习01——下载与安装
记得刚接触编程时,虽然实现了功能,但用户界面十分丑陋,老师叫我们美化一下界面,不要千篇一律,当时觉得能够写出来功能就洋洋得意了,不觉得界面丑陋。后来,在程序比赛中,我接触了一种第三方控件,它可以快速实现控件、皮肤的美化,它就是以前常用的DotNetBar,其入门使用方法见:http://www.cnblogs.com/liweis/p/4195070.html DotNetBar下载地址: 早就听说了DevExpress比较强大了,今天终于来尝试一把。
1612 0
|
IDE 开发工具 容器
devexpress v14.2.3 发布
补丁而已。 New Major Features in 14.2 What's New in VCL Products 14.2 Breaking Changes To learn about breaking changes in this version, please refer to the following page: Breaking Changes in 14.
1181 0