We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Indentations in caption summary row

When I create totals in CaptionSymmaryRow, I have no indentation:



But after export to pdf i see:



It's possible to see indentations on grid too?


5 Replies

VS Vijayarasan Sivanandham Syncfusion Team November 8, 2022 09:22 AM

We are a little unclear about your reported scenario. Please provide more information related to your requirement.

  • Can you please share your exact requirement?
  • Details about your scenario with image illustrations      
  • Video illustration of your scenario

It will be more helpful for us to check the possibilities for resolving the reported problem.



MD Michal Dziubek November 8, 2022 10:47 AM

In my scenario


#1 Load Data To Grid

#2 Add grouping:


For i = 0 To For i = 0 To jconfig.SizeOfArray("Columns") - 1
	jconfig.I = i
	grid.GroupColumnDescriptions.Add(New GroupColumnDescription() With {
										 .ColumnName = jconfig.StringOf("Columns[i].srcfield"),
										 .SortGroupRecords = True}
										 )
Next

# add totals:



Dim captionSummaryRow As New GridSummaryRow With {
	.Name = "CaptionSummary",
	.ShowSummaryInRow = False,
	.Title = "{Key}",
	.TitleColumnCount = 1
}
Dim tableSummaryRow As New GridTableSummaryRow With {
	.Name = "TableSummary1",
	.ShowSummaryInRow = False,
	.Position = VerticalPosition.Top
 }
Dim i As Integer
Dim st As GridSummaryColumn
Dim f As StringBuilder
Dim go As Boolean = False

For i = 0 To jconfig.SizeOfArray("Columns") - 1
	jconfig.I = i
	st = New GridSummaryColumn
	
	'code to genrate GridSummaryColumn
	
	captionSummaryRow.SummaryColumns.Add(st)
	tableSummaryRow.SummaryColumns.Add(st)
Next

MoveUnvisibleCol()
grid.CaptionSummaryRow = captionSummaryRow
grid.TableSummaryRows.Clear()
grid.TableSummaryRows.Add(tableSummaryRow)

The result:




I need two changes:


FIRST : I set up backcolor for caption summary row:


But as see on screenshot, when

.ShowSummaryInRow = False

The back color is white


SECOND:

I want to add borders in caption summary row.


I add handler OnDrawCell:



If (e.DataRow.RowType = RowType.CaptionRow Or e.DataRow.RowType = RowType.TableSummaryRow) Then
	Dim Format = New StringFormat()
	Dim DrawingHelper = New DrawingHelper()
	e.Style.Font.Bold = True
	Select Case e.Column.CellType
		Case "Numeric"
			e.Style.HorizontalAlignment = HorizontalAlignment.Right
		Case "TextBox"
			e.Style.HorizontalAlignment = HorizontalAlignment.Left
		Case Else
			e.Style.HorizontalAlignment = HorizontalAlignment.Center
	End Select
	'Algin "ident" column to left
	With e.OriginalSender
		If .Columns(.CaptionSummaryRow.TitleColumnCount - 1).MappingName = e.Column.MappingName Then
			e.Style.HorizontalAlignment = HorizontalAlignment.Left
		End If
	End With


	Dim ha = DrawingHelper.GetType().GetMethod("ConvertToStringAlignment", BindingFlags.NonPublic Or BindingFlags.Static, Type.DefaultBinder, New Type() {GetType(HorizontalAlignment)}, New ParameterModifier() {}).Invoke(DrawingHelper, New Object() {e.Style.HorizontalAlignment})
	Dim va = DrawingHelper.GetType().GetMethod("ConvertToStringAlignment", BindingFlags.NonPublic Or BindingFlags.Static, Type.DefaultBinder, New Type() {GetType(VerticalAlignment)}, New ParameterModifier() {}).Invoke(DrawingHelper, New Object() {e.Style.VerticalAlignment})
	Format.Alignment = CType(ha, StringAlignment)
	Format.LineAlignment = CType(va, StringAlignment)
	'GridGroupColor
	e.Graphics.FillRectangle(New SolidBrush(e.Style.BackColor), e.Bounds)
	e.Graphics.FillRectangle(New SolidBrush(GridGroupColor), e.Bounds)
	e.Graphics.DrawString(e.DisplayText, e.Style.GetFont(), New SolidBrush(e.Style.TextColor), e.Bounds, Format)
	e.Graphics.DrawLine(New Pen(e.Style.Borders.Right.Color), e.Bounds.Right - 1, e.Bounds.Top, e.Bounds.Right - 1, e.Bounds.Bottom)
	e.Graphics.DrawLine(New Pen(e.Style.Borders.Bottom.Color), e.Bounds.Left, e.Bounds.Bottom - 1, e.Bounds.Right, e.Bounds.Bottom - 1)
	'Handling the event 
	e.Handled = True
End If

Result:




Almost perfect, except for the backcolor in "ident cells" and ident/merge column Nr pozycji with ident cells.


My users mostly have a lot of rows, so they what to see total for each group after colapse:


and on the print (after exporting to pdf:




Ideally for me, with ShowSummaryInRow disabled, the grid would merge the first column with indent columns and display the caption in it



SJ Sathiyathanam Jeyakumar Syncfusion Team November 9, 2022 12:31 PM

We are currently checking possibilities to achieve your requirement from our end.  We will update with further details on November 11, 2022.



MD Michal Dziubek November 9, 2022 01:32 PM

I found error in my code, I changed backcolor in QueryRowStyle.

Indentations are very important to me because they significantly increase the readability of the grid.





DM Dhanasekar Mohanraj Syncfusion Team November 10, 2022 09:01 AM

We could see that you have created a separate support ticket for this query. Please follow the ticket for further updates.


Loader.
Live Chat Icon For mobile
Up arrow icon