TextBinding错误,找到了具有相同名称的多个对象'错误(代码:3007) [英] TextBinding Error,Multiple objects with the same name were found’ error (code: 3007)
问题描述
当我尝试为COntent创建绑定时,JavaScript API中出现了一些奇怪的问题控制它抛出错误找到了多个具有相同名称的对象',但是我没有使用相同的名称创建。这个问题
出现在其中一个文档中。请问你可以吗?提示导致问题的原因。
I have some strange issue occurring in JavaScript API, when I try to create a binding for the COntent Control its throwing the error Multiple objects with the same name were found’ ,but I am not creating with the same Name.this issue occurs in one of the document.please can u suggest why its causing the problem.
Office.context。 document.bindings.addFromNamedItemAsync(
Office.context.document.bindings.addFromNamedItemAsync(
'hellotestd' ,
'hellotestd',
Office.BindingType.Text,{id:
Office.BindingType.Text, { id:
'hellotest4234234234' },
'hellotest4234234234'},
function (结果){
function(result) {
  ;
if (result.status == = Office.AsyncResultStatus.Succeeded)
{
if(result.status === Office.AsyncResultStatus.Succeeded) {
app .showNotification(
app.showNotification(
'所选文字为:' ,
' "' + result.status
+ '"' );
'The selected text is:', '"'+ result.status + '"');
}
}
else {
else{
app.showNotification(
app.showNotification(
'错误:' ,result.error.message);
'Error:', result.error.message);
}
}
}
}
);
);
推荐答案
>>>这个问题出现在其中一个文件中。请问你为什么会这样做导致问题。
>>>this issue occurs in one of the document.please can u suggest why its causing the problem.
根据您的描述,我建议您可以使用Bindings.getAllAsync方法获取之前创建的所有绑定。
According to your description, I suggest that you could use Bindings.getAllAsync method to get all bindings that were previously created.
你可以参考下面的代码:
You could refer to below code:
function displayAllBindingNames() {
Office.context.document.bindings.getAllAsync(function (asyncResult) {
var bindingString = '';
for (var i in asyncResult.value) {
bindingString += asyncResult.value[i].id + '\n';
}
write('Existing bindings: ' + bindingString);
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
这似乎是一个知道问题。以下链接供您参考:
It seems to be a know issue. Here is the link for your reference:
有关详细信息,请单击
here 以引用Bindings.getAllAsync方法(适用于Office的JavaScript API)
For more information, click here to refer about Bindings.getAllAsync method (JavaScript API for Office)
这篇关于TextBinding错误,找到了具有相同名称的多个对象'错误(代码:3007)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!