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"; |
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
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 |
Kanimozhi B
spreadsheet.ActiveGrid.SetRowHeight(4, 4, 30);
spreadsheet.ActiveGrid.InvalidateCell(GridRangeInfo.Row(4), true);
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. |