i want access settings stored in office.context.document.settings
ribbon command function.
they have been stored task-pane don't seem accessible functionfile. accessible other task-panes.
on other hand, can store settings in functionfile not access them task-panes.
this not documented. how can transfer settings in between functionfile , task-panes?
in task pane, store setting this:
office.context.document.settings.set('sheet_backup', "foo"); office.context.document.settings.saveasync(function (asyncresult) { if (asyncresult.status == office.asyncresultstatus.failed) { console.log('settings save failed. error: ' + asyncresult.error.message); } else { console.log('settings saved.'); console.log(office.context.document.settings.get('sheet_backup')); } });
i can access fine task pane javascript file line
console.log(office.context.document.settings.get('sheet_backup'));
however, when use same line in file have declared function file in manifest ...
it returns null
.
the settings may not available in function file because need refreshed in function file's context in order latest values persisted in document. refreshasync api on settings object allows this. force refresh of in-memory settings object available function file latest values document. after doing should able read them. try following code:
office.context.document.settings.refreshasync(function (asyncresult) { var taskpaneval = asyncresult.value.get("backgroundcolor"); });
Comments
Post a Comment