Word.ContentControlAppearance enum

Apparence de ContentControl.

Remarques

[ Ensemble d’API : WordApi 1.1 ]

Les options d’apparence du contrôle de contenu sont BoundingBox, Tags ou Hidden.

Exemples

// 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();
});

Champs

boundingBox = "BoundingBox"

Représente un contrôle de contenu affiché sous la forme d’un rectangle ombré ou d’un cadre englobant (avec un titre facultatif).

hidden = "Hidden"

Représente un contrôle de contenu qui n’est pas affiché.

tags = "Tags"

Représente un contrôle de contenu affiché sous forme de marqueurs de début et de fin.