Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
excel export of WHDG missing footer value
posted

I am exporting a WHDG control to excel using WebExcelExporter.  Everything works great (I see all data, I see correct column groupings, I see proper column reordering, etc) EXCEPT for an empty footer value.

All binding is done in code-behind as the data source is determined in runtime.  I manually create the columns on the WHDG.GridView property and bind a DataSet (containing just one DataTable) to the grid control.  If a column is of a specific data type, I manually create the summary row setting via:

                whdgReport.GridView.Behaviors.SummaryRow.Enabled = true;
                var sumRowSetting = new SummaryRowSetting() { ColumnKey = rc.ColumnName, ShowSummaryButton = false, FormatString = "{0:c}" };
                sumRowSetting.SummarySettings.Add(new SummarySetting(SummaryType.Sum) { FormatString = "{1}" });
                whdgReport.GridView.Behaviors.SummaryRow.ColumnSettings.Add(sumRowSetting);
                var colSummaryInfo = new ColumnSummaryInfo() { ColumnKey = rc.ColumnName };
                colSummaryInfo.Summaries.Add(new Summary() { SummaryType = SummaryType.Sum });
                whdgReport.GridView.Behaviors.SummaryRow.ColumnSummaries.Add(colSummaryInfo);

When I export to excel, I correctly see a summary row and a value in the correct column, it just has a value of 0 instead of the sum of the columns.

Am I missing anything obvious?  After seeing all the data appear in the grid (along with the correct user edits -- column groupings and reordering), I was surprised to see the footer not get calculated correctly.

Thanks!

Parents
  • 7566
    Suggested Answer
    posted

    Hello Kfiduk,

     

     

    When you export the grid the summary row will apply the formula to the excel which means that if you have your columns from type string it will not represent the final result and 0 will appear there. Set the column types to be numerable in order for this to calculate them correctly.

     

    I hope this helps.

    For any further questions do not hesitate to contact me.

     

    Sincerely,

    Georgi Sashev

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

Reply Children