Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Word.ContentControlAppearance enum

Package:
word

Represents the content control appearance.

Remarks

API set: WordApi 1.1

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/10-content-controls/insert-and-change-content-controls.yaml

// Adds title and colors to odd and even content controls and changes their appearance.
await Word.run(async (context) => {
 // Get the complete sentence (as range) associated with the insertion point.
 let evenContentControls = context.document.contentControls.getByTag("even");
 let oddContentControls = context.document.contentControls.getByTag("odd");
 evenContentControls.load("length");
 oddContentControls.load("length");

 await context.sync();

 for (let i = 0; i < evenContentControls.items.length; i++) {
 // Change a few properties and append a paragraph.
 evenContentControls.items[i].set({
 color: "red",
 title: "Odd ContentControl #" + (i + 1),
 appearance: Word.ContentControlAppearance.tags
 });
 evenContentControls.items[i].insertParagraph("This is an odd content control", "End");
 }

 for (let j = 0; j < oddContentControls.items.length; j++) {
 // Change a few properties and append a paragraph.
 oddContentControls.items[j].set({
 color: "green",
 title: "Even ContentControl #" + (j + 1),
 appearance: "Tags"
 });
 oddContentControls.items[j].insertHtml("This is an <b>even</b> content control", "End");
 }

 await context.sync();
});

Fields

boundingBox = "BoundingBox"

Represents a content control shown as a shaded rectangle or bounding box (with optional title).

hidden = "Hidden"

Represents a content control that isn't shown.

tags = "Tags"

Represents a content control shown as start and end markers.


Feedback

Was this page helpful?