【问题标题】:Export Pivot Grid as Grid View to Excel将透视网格作为网格视图导出到 Excel
【发布时间】:2015-02-26 15:38:07
【问题描述】:

所以这可能看起来很奇怪,但这是我目前正在处理的情况。目标是从 Pivot Grid 中获取数据并将其放入 Grid View,然后将该 Grid View 导出到 Excel。

目前有一个工作版本可以根据从透视网格中提取的数据构建网格视图,但是,当我构建网格视图时,我丢失了透视网格所具有的格式。我的问题是如何从 Pivot Grid 中捕获该格式,以及如何将其添加回 Grid View?

【问题讨论】:

    标签: c# asp.net-mvc-3 devexpress-mvc


    【解决方案1】:

    我找到了解决方案。如下。

    gridSettings.SettingsExport.RenderBrick = (sender, e) =>
                {
                    foreach (MVCxPivotGridField item in dataFields)
                    {
                        if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data
                            && !string.IsNullOrEmpty(item.CellFormat.FormatString))
                            e.TextValueFormatString = item.CellFormat.FormatString;
                    }
    

    Grid Settings 是我的网格,dataFields 是来自 Pivot Grid 的数据。我刚刚遍历数据,发现哪里有 Pivot Grid 的格式字符串,然后将相同的格式设置为 Grid View。 };

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多