Hello,
we are using the Ultra win grid to show some values and such, like for instance the balance of a bank account. And when we export it theres always a grandtotal appearing at the bottom of the excel sheet with the totals of *all* columns. How can we disable that?
Hi,
Neither the grid nor the exporter automatically add any summaries. So if you are seeing summaries in the export that are not displayed in the grid, then your code must be adding those summaries into the layout somewhere. Check your code for calls to the Summaries.Add method, which is the typical method by which you would add a summary in code.
It's also possible to add summaries by loading a Layout into the grid. So if you don't see "Summaries.Add" anywhere, check for places where you might be calling grid.DisplayLayout.Load.
If none of that helps, then you could try handling the ExportStarted event of the UltraGridExcelExporter and explicitly calling Summaries.Clear on each band in e.Layout.Bands to remove all summaries from the export layout.
Well, the thing is i have no clue about any of this, much less the code behind it. I was practically thrown into this project, but anyways. I noticed these lines in the Initialize method of the grid
GridControl.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Bottom | SummaryDisplayAreas.GroupByRowsFooter; GridControl.DisplayLayout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells; var summaryFooterCaptionVisible = DefaultableBoolean.False; if(ShowSummaryFooterCaption) summaryFooterCaptionVisible = DefaultableBoolean.True; GridControl.DisplayLayout.Override.SummaryFooterCaptionVisible = summaryFooterCaptionVisible;GridControl is of type UltraGrid.So far what i figured out is that all the "datasets" are in a "band". And the grid only has one band. It shows a summary for all values per dataset, which is correct, but then it shows a grand summary of all summaries of all datasets at the very bottom, which isnt wanted.The only things ive managed so far is to not show ANY summaries whatsoever or hide the band, and thus everything. I literally get a blank page then
Okay... I think you just need to get rid of SummaryDisplayAreas.GroupByRowsFooter.
//GridControl.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Bottom | SummaryDisplayAreas.GroupByRowsFooter;GridControl.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Bottom;
I disagree about the excel exporter not adding summary rows automatically. I have a very simple program, just added the excel exporter component to the main windows form and have a very export process of the following. Sure enough, at the bottom of the excel file there is a summary row showing the count of rows, "Count = 59".
I have done nothing to the excel exporter except for what is shown below as I just added this code to my program, so why is there a summary row in the very first excel export of this data?
private void ubtnExportGrid_Click(object sender, EventArgs e) { ugEE.Export(ugMonthlyPeriods, _currentSite.SiteName + ".xlsx"); } private void ugEE_CellExporting(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.CellExportingEventArgs e) { if (e?.GridValue != null) { var cellType = e.GridValue.GetType().FullName; if (cellType == "System.Double") { var cellContents = e.GridValue.ToDoubleSafe(0); e.ExportValue= $"{cellContents:F2}"; } } }
So I guess my original reply was a bit ambiguous. What I wrote was "if you are seeing summaries in the export that are not displayed in the grid."If your on-screen grid has summaries, then they will be exported to Excel by default. Also, this post is 3 years old, so I'm not sure why you are making this point now. :)Do you have a question about this?