Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SheetBeforeDoubleClick and merged cells
Dear Reader
I succesfully implemented SheetBeforeDoubleClick (Excell application level) using VSTO end VS 2005 (professional) It works as long as cells ain't merged together. when I double-click on single cells everything works as expected, however any merged cell seems to destroy the event hookup, since after this even clicking a single cell does not work anymore. Thus presents I reckon a serious drawback in the layout-possibility of a spreadsheet with C#-implemented add-inns. I'm currently at a loss to this issue, any idea's I welcome! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SheetBeforeDoubleClick and merged cells
It could be that you code is not dealing with merged cells correctly and is
producing errors. NickHK "Aale de Winkel" wrote in message ... Dear Reader I succesfully implemented SheetBeforeDoubleClick (Excell application level) using VSTO end VS 2005 (professional) It works as long as cells ain't merged together. when I double-click on single cells everything works as expected, however any merged cell seems to destroy the event hookup, since after this even clicking a single cell does not work anymore. Thus presents I reckon a serious drawback in the layout-possibility of a spreadsheet with C#-implemented add-inns. I'm currently at a loss to this issue, any idea's I welcome! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SheetBeforeDoubleClick and merged cells
.....
app.SheetBeforeDoubleClick += new Microsoft.Office.Interop.Excel.AppEvents_SheetBefo reDoubleClickEventHandler(app_SheetBeforeDoubleCli ck); ..... void app_SheetBeforeDoubleClick(object Sh, Microsoft.Office.Interop.Excel.Range Target, ref bool Cancel) { MessageBox.Show("Hello") } Changed to the above to test your assumption! and indeed you seem to be right since both single cell and merged cell yield "hello" so there must be something inside my eventhandler that disables it to function! Thanks, I'll need to study further. It is just that I see nothing in my code that makes use of the fact that cells aren't merged. So the deactivation is unexpected. Will take some time to figure out what exactly deactivates the event Thanks "NickHK" wrote: It could be that you code is not dealing with merged cells correctly and is producing errors. NickHK "Aale de Winkel" wrote in message ... Dear Reader I succesfully implemented SheetBeforeDoubleClick (Excell application level) using VSTO end VS 2005 (professional) It works as long as cells ain't merged together. when I double-click on single cells everything works as expected, however any merged cell seems to destroy the event hookup, since after this even clicking a single cell does not work anymore. Thus presents I reckon a serious drawback in the layout-possibility of a spreadsheet with C#-implemented add-inns. I'm currently at a loss to this issue, any idea's I welcome! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
SheetBeforeDoubleClick and merged cells
You could record a macro i Excel of the actions on the merged cells to see
the required VBA. Then translate to C#. NickHK "Aale de Winkel" ... .... app.SheetBeforeDoubleClick += new Microsoft.Office.Interop.Excel.AppEvents_SheetBefo reDoubleClickEventHandler(app_SheetBeforeDoubleCli ck); .... void app_SheetBeforeDoubleClick(object Sh, Microsoft.Office.Interop.Excel.Range Target, ref bool Cancel) { MessageBox.Show("Hello") } Changed to the above to test your assumption! and indeed you seem to be right since both single cell and merged cell yield "hello" so there must be something inside my eventhandler that disables it to function! Thanks, I'll need to study further. It is just that I see nothing in my code that makes use of the fact that cells aren't merged. So the deactivation is unexpected. Will take some time to figure out what exactly deactivates the event Thanks "NickHK" wrote: It could be that you code is not dealing with merged cells correctly and is producing errors. NickHK "Aale de Winkel" wrote in message ... Dear Reader I succesfully implemented SheetBeforeDoubleClick (Excell application level) using VSTO end VS 2005 (professional) It works as long as cells ain't merged together. when I double-click on single cells everything works as expected, however any merged cell seems to destroy the event hookup, since after this even clicking a single cell does not work anymore. Thus presents I reckon a serious drawback in the layout-possibility of a spreadsheet with C#-implemented add-inns. I'm currently at a loss to this issue, any idea's I welcome! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
SheetBeforeDoubleClick and merged cells
for some reason my responses before hasn't shown up so my final solution to
the incomprehensable Redmond-logic is: object TargetValue(Microsoft.Office.Interop.Excel.Range Target) { bool merged = (bool) Target.MergeCells; if (!merged) return Target.get_Value(Excel.XlRangeValueDataType.xlRang eValueDefault); else try { object[,] arr = (object[,])Target.get_Value(Excel.XlRangeValueDataType.xlRan geValueDefault); // new object[Target.Rows.Count, Target.Columns.Count]; return arr[1,1]; // VSTO logic C# should be arr[0,0] !!! } catch (Exception ex) { MessageBox.Show("TargetValue HUMBUG \r\n" + ex.ToString()); } return null; } "NickHK" wrote: You could record a macro i Excel of the actions on the merged cells to see the required VBA. Then translate to C#. NickHK "Aale de Winkel" ... .... app.SheetBeforeDoubleClick += new Microsoft.Office.Interop.Excel.AppEvents_SheetBefo reDoubleClickEventHandler(app_SheetBeforeDoubleCli ck); .... void app_SheetBeforeDoubleClick(object Sh, Microsoft.Office.Interop.Excel.Range Target, ref bool Cancel) { MessageBox.Show("Hello") } Changed to the above to test your assumption! and indeed you seem to be right since both single cell and merged cell yield "hello" so there must be something inside my eventhandler that disables it to function! Thanks, I'll need to study further. It is just that I see nothing in my code that makes use of the fact that cells aren't merged. So the deactivation is unexpected. Will take some time to figure out what exactly deactivates the event Thanks "NickHK" wrote: It could be that you code is not dealing with merged cells correctly and is producing errors. NickHK "Aale de Winkel" wrote in message ... Dear Reader I succesfully implemented SheetBeforeDoubleClick (Excell application level) using VSTO end VS 2005 (professional) It works as long as cells ain't merged together. when I double-click on single cells everything works as expected, however any merged cell seems to destroy the event hookup, since after this even clicking a single cell does not work anymore. Thus presents I reckon a serious drawback in the layout-possibility of a spreadsheet with C#-implemented add-inns. I'm currently at a loss to this issue, any idea's I welcome! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy paste non merged to merged cells | Excel Worksheet Functions | |||
How can I sort an Excel Doc containing merged & non-merged cells? | Excel Discussion (Misc queries) | |||
Autofit Merged cell Code is changing the format of my merged cells | Excel Discussion (Misc queries) | |||
how do i link merged cells to a merged cell in another worksheet. | Excel Worksheet Functions | |||
Sorting merged cellsHow do I sort merged cells not identically siz | Excel Worksheet Functions |