How to Track the event in Excel for cell insert/delete in C++ or VC++ for ?
-
Please can someone tell me how to track single/multiple cell insert/delete event in Excel. I have done with most of the events but fighting for this ? please suggest ..... We can add cells through context menu option (Right click) and Menu option ...but what are the events in C++ to catch this ...
-
Please can someone tell me how to track single/multiple cell insert/delete event in Excel. I have done with most of the events but fighting for this ? please suggest ..... We can add cells through context menu option (Right click) and Menu option ...but what are the events in C++ to catch this ...
The Workbook object has a 'SheetChange' event. The Worksheet object has a 'Change' event. Either of these will be fired if you change that worksheet.. So, if you have a workbook that contains Sheet1, Sheet2 and Sheet3, the SheetChange event of the workbook will be fired when ANY of Sheet1, Sheet2 and Sheet3 change. Sheet1 will fire the 'Change' event when it is changed. Sheet2 will fire the 'Change' event when it is changed. Sheet3 will fire the 'Change' event when it is changed. Simple as.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
The Workbook object has a 'SheetChange' event. The Worksheet object has a 'Change' event. Either of these will be fired if you change that worksheet.. So, if you have a workbook that contains Sheet1, Sheet2 and Sheet3, the SheetChange event of the workbook will be fired when ANY of Sheet1, Sheet2 and Sheet3 change. Sheet1 will fire the 'Change' event when it is changed. Sheet2 will fire the 'Change' event when it is changed. Sheet3 will fire the 'Change' event when it is changed. Simple as.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
Hi Stuart, When cell is inserted, only cell where the new cell is inserted or deleted will be tracked in sheetchange event. But whereas the allignment of data cannot be tracked. For example: if following is the data before cell insert c0 c1 c2 c3 r0 1 2 3 4 r1 2 3 4 5 r2 3 4 5 6 If say I have inserted cell at r1c1 then the allignment of data after cell insert will be: c0 c1 c2 c3 c4 r0 1 2 3 4 r1 2 * 3 4 5 r2 3 4 5 6 * represents blank cell is inserted. How to track this change in allignment? For above example allignment change data will be:(r1c2:3,r1c3:4,r1c4:5) Following is the code in sheet change: _bstr_t result= target->GetAddress(1,1,Excel::XlReferenceStyle::xlR1C1,1,1); In result we are getting only r1c1. As of now we are able to do it when user inserts the cell using context menu: right click->insert, this we are tracking in sheetbeforerightclick, where we are setting the bool flag , and immediately in sheet change we are checking the same bool flag for true , if it is true then we are reading that complete row and complete col.But this will not work when user inserts/deletes the cell through menu. Please guide us to get this change in allingment of data for all the four options: cell insert/delete(shift cells right, shift cells down)/(shift cells up, shift cells left) when user inserts cell either through context menu or menu. Thanks in Advance, Regards, KTTransfer.
-
Hi Stuart, When cell is inserted, only cell where the new cell is inserted or deleted will be tracked in sheetchange event. But whereas the allignment of data cannot be tracked. For example: if following is the data before cell insert c0 c1 c2 c3 r0 1 2 3 4 r1 2 3 4 5 r2 3 4 5 6 If say I have inserted cell at r1c1 then the allignment of data after cell insert will be: c0 c1 c2 c3 c4 r0 1 2 3 4 r1 2 * 3 4 5 r2 3 4 5 6 * represents blank cell is inserted. How to track this change in allignment? For above example allignment change data will be:(r1c2:3,r1c3:4,r1c4:5) Following is the code in sheet change: _bstr_t result= target->GetAddress(1,1,Excel::XlReferenceStyle::xlR1C1,1,1); In result we are getting only r1c1. As of now we are able to do it when user inserts the cell using context menu: right click->insert, this we are tracking in sheetbeforerightclick, where we are setting the bool flag , and immediately in sheet change we are checking the same bool flag for true , if it is true then we are reading that complete row and complete col.But this will not work when user inserts/deletes the cell through menu. Please guide us to get this change in allingment of data for all the four options: cell insert/delete(shift cells right, shift cells down)/(shift cells up, shift cells left) when user inserts cell either through context menu or menu. Thanks in Advance, Regards, KTTransfer.
It doesn't look like you can do that.... Which leads to the question WHY are you trying to track these changes? What's the higher level requirement? There is likely some other, better way of achieving what you really need....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
It doesn't look like you can do that.... Which leads to the question WHY are you trying to track these changes? What's the higher level requirement? There is likely some other, better way of achieving what you really need....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
yes ..we need to track these changes for better optimization..If suppose somebody ass /deletes single /multiple cells in sheet then as described other cells will get shift to newer positions ..so we nned to update these changes to some server ...to be in sync with sheets ..but we dont want to send whole data from sheet again to server ..we just want to send latest updated cell ..so we need this event to track this cells...
-
yes ..we need to track these changes for better optimization..If suppose somebody ass /deletes single /multiple cells in sheet then as described other cells will get shift to newer positions ..so we nned to update these changes to some server ...to be in sync with sheets ..but we dont want to send whole data from sheet again to server ..we just want to send latest updated cell ..so we need this event to track this cells...
Sounds like your optimisation strategy isn't feasible...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
Sounds like your optimisation strategy isn't feasible...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
OK ..we have achived this in most of the events ..only this is missing ...anyways ..so according to u for this changes in sheet we need to send complete image of shet to server ? is that so ?
-
OK ..we have achived this in most of the events ..only this is missing ...anyways ..so according to u for this changes in sheet we need to send complete image of shet to server ? is that so ?
Probably the only reliable thing to do... How big are these worksheets that you need to optimise like this? Are you sure it's not premature optimisation...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
Probably the only reliable thing to do... How big are these worksheets that you need to optimise like this? Are you sure it's not premature optimisation...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
these are very big sheets ..like one cell can contain 3K of data ..then you can assume the size of data we are passing to server ..so need this optimization ...and Its safe one
-
these are very big sheets ..like one cell can contain 3K of data ..then you can assume the size of data we are passing to server ..so need this optimization ...and Its safe one
Hi Stuart, Is there any chance to track the "menu" selected by user in Excel Menu Items. If we get this, then we can achieve tracking allignment of data? Regards, KTTransfer.