I have 2 bands -[0] and [1]
on band[1] I have column HAPINT_SPREAD_AMOUNT
I want to do a summary on band 1 for this column and then for the same column
give the total summary ( for band 0)
The followin code just shows me the summary for band[1]
basicInfraGrid1.DisplayLayout.Bands[1].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, basicInfraGrid1.DisplayLayout.Bands[1].Columns["HAPINT_SPREAD_AMOUNT"]); basicInfraGrid1.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.GroupByRowsFooter | SummaryDisplayAreas.Bottom; basicInfraGrid1.DisplayLayout.Bands[0].Summaries.Add( Infragistics.Win.UltraWinGrid.SummaryType.Sum, basicInfraGrid1.DisplayLayout.Bands[1].Columns["HAPINT_SPREAD_AMOUNT"]);
Hello Drpoalim,
Maybe one possible approach is to use property Summaries for the both Bands. Could you please take a look at the attached sample for more details. Please let me know if you think that I misunderstood your scenario or if you have any questions.
Regards
This is my scenario.
I dont understand the proposed solution.
What do you mean "property Summaries for the both Bands"?
?Could you show me in code?
What you can do is handle the SummaryExported event of the UltraGridExcelExporter and set the Value on the worksheet cell to the numeric value of the summary instead of the display text.
private void ultraGridExcelExporter1_SummaryCellExported(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.SummaryCellExportedEventArgs e) { e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = e.Summary.Value }
When I export to excel I want the summaries to be numeric type.
but in the export, The cell of the total summary is in a text type and not numeric as I want.
The sub totals are in numeric type.
basicInfraGrid1.DisplayLayout.Bands[1].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, basicInfraGrid1.DisplayLayout.Bands[1].Columns["HAPINT_SPREAD_AMOUNT"], Infragistics.Win.UltraWinGrid.SummaryPosition.Right); basicInfraGrid1.DisplayLayout.Bands[1].Summaries[0].SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.Top; basicInfraGrid1.DisplayLayout.Bands[0].Summaries.Add( Infragistics.Win.UltraWinGrid.SummaryType.Sum, basicInfraGrid1.DisplayLayout.Bands[1].Columns["HAPINT_SPREAD_AMOUNT"], Infragistics.Win.UltraWinGrid.SummaryPosition.Right);
basicInfraGrid1.DisplayLayout.Bands[0].Summaries[0].DisplayFormat = "{0:##,##0.00#}"; basicInfraGrid1.DisplayLayout.Bands[1].Summaries[0].DisplayFormat = "{0:##,##0.00#}"; basicInfraGrid1.DisplayLayout.Bands[0].Summaries[0].SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.Bottom;
Thanks
It seems that the problem is indeed the SummaryDisplayArea.
I assigned the SummaryDisplayArea for both Band[0], and Band[1] and now it shows for both.
Hi,
Maybe one possible approach to achieve this behavior is by using the UltraGrid`s designer ( I used this approach in my previous sample), but you are able to achieve the same with the code below:
private void Form1_Load(object sender, EventArgs e){ ultraGrid1.DisplayLayout.Bands[1].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[1].Columns["D"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn); ultraGrid1.DisplayLayout.Bands[1].Summaries[0].DisplayFormat = "Total = {0}"; ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[1].Columns["D"], Infragistics.Win.UltraWinGrid.SummaryPosition.Right); ultraGrid1.DisplayLayout.Bands[0].SummaryFooterCaption = "Grand Total"; ultraGrid1.DisplayLayout.Bands[0].Summaries[0].DisplayFormat = "My Sum = {0}"; ultraGrid1.DisplayLayout.Bands[0].Summaries[0].SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.BottomFixed;}
Please take a look at the new attached sample where I create a summaries via code. Please if you have any questions, do not hesitate to ask meRegards