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.
Unfortunately, activation email could not send to your email. Please try again.

merging cells at different rows and columns

Thread ID:

Created:

Updated:

Platform:

Replies:

67076 Aug 8,2007 07:29 AM Aug 9,2007 03:25 AM Windows Forms 1
loading
Tags: Grouping
ejaz
Asked On August 8, 2007 07:29 AM

Hi,
I am using grid grouping,and I need to merge two cells at different row and at different columns.
ex.
I have five colums c1,c2,c3,c4,c5 and 10 rows from r1-r10.
Now at row no r1 I need to merge c1 and c2 showing only c1 content but c3,c4,c5 will be showing there content.similarly at row r3 I need to merge c3 and c4 showing c3 content,rest of the colums will be showing there content.This coulld happen at any row and any columns depending on the no of columns.At the same time I need to format the content and font of the cells.


Jeba S [Syncfusion]
Replied On August 9, 2007 03:25 AM

Hi ejaz,

Thank you for your details.

You can use the CoveredCells collection in the grid to merge cells at different rows and columns by passing the Cells/Cell, Cols/Col

and Rows/Row in GridRangeInfo.

Please refer this code snippets:

this.gridGroupingControl1.TableModel.CoveredRanges.Add(GridRangeInfo.Cells(4, 1, 4, 2));
this.gridGroupingControl1.TableModel.CoveredRanges.Add(GridRangeInfo.Cells(6, 3, 6, 4));


You can format the covered cells by handling the QueryCellStyleInfo event and set the required styles.

void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if ((e.TableCellIdentity.RowIndex == 4 && e.TableCellIdentity.ColIndex == 1)
||(e.TableCellIdentity.RowIndex == 6 && e.TableCellIdentity.ColIndex == 3))
{
e.Style.Font.Bold = true;
e.Style.Font.Facename = "Arial";
e.Style.Font.Size = 12;
e.Style.BackColor = Color.Pink;
}
}


Please refer the sample which illustrates the above said feature:
http://websamples.syncfusion.com/samples/Grid.Windows/F67076/main.htm

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;