It's high time to reveal another screte which microsoft is shipping with SPS 2010. For some it may not be screte but I am sure the code snippet is screte for most of the readers. let's jump to topic directly.
The New functionality is Editable excel sheet, which means the user can edit sheet in EWA. more detailed is - developer uses Excel Web Access EWA to render excel sheet in SharePoint, Till MOSS it was just readonly now user can edit the sheet there only. How it is possible?
The developer team introduced another property 'Allow Type and Formula' which is visible from web part properties, once this check box is checked user can edit the sheet right away.
ewa= Ewa.EwaControl.getInstances().getItem(0); // --get handle of currently rendered workbook
workbook = ewa.getActiveWorkbook(); // handle of active workbook;
rangelocal = workbook.getActiveCell(); //handle of active cell
var column = rangelocal.getColumn(); //
var row = rangelocal.getRow();
var valueArray = new Array(1);
valueArray = new Array(1);
valueArray = selectedValue;
lets talk highlighted Text. we will reverse track here, will start from green one.
- setValuesAsync() is the function responsible for setting range value using async call back.
- asyncCallbackSet is my call back function, 'SetValue' is context.
- valueArray this is the 2-Dimensional array contains value for the cell. Now why it is 2 - dimensional as it is excel where cell is row and column, so the first index represents row and second column.
asyncResult gives option to trace error using asyncResult.getCode() and asyncResult.getDescription()
excecute this simple code and feel the power.