AD
Administrator
Syncfusion Team
October 12, 2007 09:10 AM UTC
By default, GridControl supports 2 Clipboard formats. One uses GridStyleInfo objects, and the other is just text.
So, when you copy/paste or D&D from the grid to the grid, then grid can access the style information on the clipboard to handle the formulas.
But when you are coming from excel, there is no style information on the clipboard (or in the drag object), so this means that the grid can only use the text support, which normally only has the computed values from excel and not the formulas.
Here are 2 ways you can address this issue.
The first is simple and requires no coding. In excel, before you copy or initiate a drag, press ctl+` to tell excel to show all formulas. Then the formulas get put on the clipboard as text, and will get pasted into the grid as formulas (as long as you have set up up all cells to be formulas with code such as grid.TableStyle.CellType = "FormulaCell".)
The other way is significantly more work, but does not rely on your users using ctl+` to toggle formula displaying in excel. Instead, it requires that you handle the Paste or the drop in the grid, get the excel object from the clipboard, and handle setting the formulas directly into the grid cells. Our XlsIO would be useful in doing this, but this would take some coding.