Marge cells in SfSpreadsheet
Thank you for contacting Syncfusion Support.
For merging the cells, you need to add the coveredcellinfo into Coveredcells collection of SpreadsheetGrid and merge the range using Merge method in XlsIO. We have modified your code example below,
|
var sh = this.AssociatedObject; var wb = sh.Workbook; var ws = wb.Worksheets[0]; var coveredcell = new CoveredCellInfo(1, 1, 2, 2); sh.ActiveGrid.CoveredCells.Add(coveredcell); var cell = ws.Range[1, 1, 2, 2]; cell.Merge(); cell.Value2 = "test test test"; |
We have modified the sample based on your requirement. Please find the link below
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CS1986002482
Please refer the UG link to know more about Merge cells:
http://help.syncfusion.com/wpf/sfspreadsheet/formatting#merge-cells
Regards
Kanimozhi B
Attachment: Example_4c1c3d57.rar
Hi Berezkin Gena,
We have analyzed your issue
with the sample. We could find that the cells of the worksheet[“ws.Cells[]”] which you get for applying merge cells
and line style takes more time, hence we have modified the sample by looping
the UsedRange of the IWorksheet and add that specific style to the range which
meets your requirement.
Please find the attached
modified sample
Regards
Kanimozhi B
Attachment: CS_3d4f586b.zip
|
Query |
Response | |
|
Is it possible to change the style of the cell in the following way? cell.CellStyle = cell2.CellStyle |
You can change the style of the cell by assigning CellStyleName as like below,
| |
|
How to change the height of the cell? |
Please refer the below UG link to change the height and width of the cell, http://help.syncfusion.com/wpf/sfspreadsheet/rows-and-columns#row-height-and-column-width |
Regards
Kanimozhi B spreadsheet.ActiveGrid.SetRowHeight(4, 4, 30);
spreadsheet.ActiveGrid.InvalidateCell(GridRangeInfo.Row(4), true);Please find the details below,
|
Query |
Response | |
|
am wondering how I can programmatically copy the style of one cell to another? At the same time, I do not know what will be the style in both cells. If I use the CellStyleName property, a piece of information about setting up the cell may be lost. |
You can achieve your requirement like the below code example
| |
|
But the value passed SetRowHeight () is set incorrectly. For example, if I set value 30 (spreadsheet.ActiveGrid.SetRowHeight (4, 4, 30)), the assigned value will be equal to 22.5 |
The value “30” which you set in SetRowHeight() function is in Pixels, whereas the assigned value “22.5” is in terms of Points. In Excel, the pixel size “30” equals to “22.5” points. |
Regards
Kanimozhi B
- 8 Replies
- 2 Participants
-
BG Berezkin Gena
- Mar 4, 2016 10:38 AM UTC
- Mar 18, 2016 12:39 PM UTC