Ich möchte die Inhaltskontrolle in Word mit Office-js Wort api hinzufügen. Ich verwende die insertContentControl-Methode, aber diese Methode wird nicht am Ende des Dokuments oder am bestimmten Einfügeort hinzugefügt. Unten ist mein Code: -Einfügen der Inhaltskontrolle in Word mit Office-js Wort api
Word.run(function (context) {
var body = context.document.body;
var contents = body.contentControls;
// Queue a commmand to wrap the body in a content control.
var a = body.insertContentControl();
a.appearance = "name";
a.tag = "name1";
a.title = "name";
return context.sync().then(function() {
// context.load(body);
console.log('Wrapped the body in a content control.');
});
})
.catch(function (error) {
console.log('Error: ' + JSON.stringify(error));
if (error instanceof OfficeExtension.Error) {
console.log('Debug info: ' + JSON.stringify(error.debugInfo));
}
});
Auch mag ich die Eigenschaften, um es wie Aussehen, Tag, Titel auf das neue Content-Steuerelement hinzuzufügen erstellt