lundi 30 novembre 2015

Adding header text to a Pivot Grid on Export to Excel

I'm currently working on adding custom text to the very top of my Excel export from a Pivot Grid (DevExpress MVC). My customer has requested that I place a date time stamp at the top (header area). However, I am so far unsuccessful in figuring out how to tap into the export functionality. Below is my current code in the Controller.

public ActionResult ExportPivotGrid()
            Session["QPTReportsData"] = QPTReport.GetReportData(Helper.OfficeName);

            XlsxExportOptionsEx xopt = new XlsxExportOptionsEx();
            xopt.AllowHyperLinks = DefaultBoolean.True;
            xopt.ExportHyperlinks = true;
            xopt.TextExportMode = TextExportMode.Text;
            xopt.ExportType = DevExpress.Export.ExportType.WYSIWYG;

            return PivotGridExtension.ExportToXlsx(new PivotGridSettings()
                Name = "ExportPivotGrid",
                BeforePerformDataSelect = (s, e) =>
                    MVCxPivotGrid PivotGrid = s as MVCxPivotGrid;
                    string layout = (string)(Session["QPTCurrentPivGridLayout"]);
                    PivotGrid.LoadLayoutFromString(layout, DevExpress.Web.ASPxPivotGrid.PivotGridWebOptionsLayout.DefaultLayout);
            }, Session["QPTReportsData"], true, xopt);


From what I can tell, there is no simple solution. Any help would be much appreciated.

Aucun commentaire:

Enregistrer un commentaire