|
|
Hi, I am using VS2012 Ultimate edition to run the solution and I am getting the following error. Unhandled exception at line 10, column 13 in http://localhost:16624/Scripts /NewSelectionCo ordinates.js 0x800a138f - JavaScript runtime error: Unable to get property 'type' of undefined or null reference. I am just running the app and hitting the Set Binding button. Any help would be appreciated. var message = ('Added new binding with type: ' + asyncResult.val ue.type + ' and id: ' + asyncResult.val ue.id); is the line where it breaks. Regards, Mayur.
Hi Mayur, When running the script the error on line 10 is created by the missing MyRange. The addFromNamedItemAsync("myRange ", "matrix", { id: 'myMatrix' }, function (asyncResult) If you select a few cells and create them as MyRange you will see the results of the message. Alternativly you can also add error handeling by adding a function when myRange is missing. I hope this helps. Regards, Menno
Thanks Menno. Now I understand how it works. I have one more question on that though. Is it possible for me to lock/format/give a background color to a current selected cell with the help of the coordinated? Regards, Mayur.
Dear MayurParmar, If you add the following to the first few lines you will not get an error:
if (asyncResult.st atus == 'succeeded'){
var message = ('Added new binding with type: ' + asyncResult.val ue.type + ' and id: ' + asyncResult.val ue.id);
write(message);
addEventHandler ();
}
else
write('Error: ' + asyncResult.err or.message);
});
}
It is possible to write back values to the current selected cell. Maybe you can start with the following and instead of just values add other properties like formats:
function addTextToDocume nt() {
var e = document.getEle mentById("input ");
var text = e.value;
Office.context. document.setSel ectedDataAsync( text,
function (asyncResult) {});
}
Maybe you can change the e.value to e.format. I only used the setSelectedeDat aAsync recently in a example. After running the following tutorial the created functions became clear to me. http://msdn.mic rosoft.com/en-u s/library/offic e/apps/jj220065 (v=office.15)
Hope these help.
Regards,
Menno
I am using VS 2012 RC Ultimate and get the following error message when attmpting to open the solution. 'AgaveApp' is not a valid value for the project property 'ProjectMode' Please advise. ~ Bruce
Hi Bruce-- Thanks for your comment, and sorry about the trouble you were having. This issue was brought to our attention only recently, and just today we were able to publish a revised version of this sample. The new version is here: http://code.msdn.microsoft.com /officeapps/App s-for-Office-Ge t-51cc1aac Please let us know if you continue to have any problems running this or any other of our samples! Thanks! Saul