Posted 28 May 2020, 4:15 am EST - Updated 3 October 2022, 2:48 pm EST
Alignment of the Column Grand Total / Column Sub Total
Posted by: nitin on 28 May 2020, 4:15 am EST
-
-
Posted 28 May 2020, 7:51 pm EST
Hi Nitin,
The Total column is a special column in FlexPivotGrid so it has a different style and formatting from other columns and it is the default behavior that the alignment of the text in the Total column is aligned center.
If you want it to aligned right then use the code snippet given below:Dim fp = _c1FlexPivotPage.FlexPivotEngine AddHandler fp.Updated, AddressOf FlexPivot_Updated Private Sub FlexPivot_Updated(sender As Object, e As EventArgs) Dim total As String = _c1FlexPivotPage.FlexPivotGrid.Cols(_c1FlexPivotPage.FlexPivotGrid.Cols.Count - 1).Caption If total = "Total" Then _c1FlexPivotPage.FlexPivotGrid.Cols(_c1FlexPivotPage.FlexPivotGrid.Cols.Count - 1).TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.RightCenter End If End Sub
I hope it helps.
If you need any other help, please let us know.Regards,
Prabhat Sharma. -
Posted 28 May 2020, 11:48 pm EST
Hi,
It worked. Thank you
I think these type of things should be part of the manual. -
Posted 24 June 2020, 12:25 am EST - Updated 3 October 2022, 2:48 pm EST
Sir,
Above solution is not working for multiple Total columns.
Please suggest, how to identify the Total Columns -
Posted 24 June 2020, 3:33 pm EST
Hi Nitin,
You can use the code snippet given below to achieve the desired behavior by iterating among the cols of FlexPivotGrid:
Private Sub FlexPivot_Updated(sender As Object, e As EventArgs) For j As Integer = 0 To _c1FlexPivotPage.FlexPivotGrid.Cols.Count - 1 Dim total As String = _c1FlexPivotPage.FlexPivotGrid.Cols(j).Caption If total = "Total" Then _c1FlexPivotPage.FlexPivotGrid.Cols(j).Style.TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.RightCenter End If Next End Sub
Regards,
Prabhat Sharma.