Word.ShadingTextureType enum

Represents the shading texture. To learn more about how to apply backgrounds like textures, see Add, change, or delete the background color in Word.

Remarks

[ API set: WordApiDesktop 1.1 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/manage-styles.yaml

// Updates shading properties (e.g., texture, pattern colors) of the specified style.
await Word.run(async (context) => {
  const styleName = $("#style-name").val() as string;
  if (styleName == "") {
    console.warn("Enter a style name to update shading properties.");
    return;
  }

  const style: Word.Style = context.document.getStyles().getByNameOrNullObject(styleName);
  style.load();
  await context.sync();

  if (style.isNullObject) {
    console.warn(`There's no existing style with the name '${styleName}'.`);
  } else {
    const shading: Word.Shading = style.shading;
    shading.load();
    await context.sync();

    shading.backgroundPatternColor = "blue";
    shading.foregroundPatternColor = "yellow";
    shading.texture = Word.ShadingTextureType.darkTrellis;

    console.log("Updated shading.");
  }
});

Fields

darkDiagonalDown = "DarkDiagonalDown"

Represents dark diagonal-down texture.

darkDiagonalUp = "DarkDiagonalUp"

Represents dark diagonal-up texture.

darkGrid = "DarkGrid"

Represents dark horizontal-cross texture.

darkHorizontal = "DarkHorizontal"

Represents dark horizontal texture.

darkTrellis = "DarkTrellis"

Represents dark diagonal-cross texture.

darkVertical = "DarkVertical"

Represents dark vertical texture.

lightDiagonalDown = "LightDiagonalDown"

Represents light diagonal-down texture.

lightDiagonalUp = "LightDiagonalUp"

Represents light diagonal-up texture.

lightGrid = "LightGrid"

Represents light horizontal-cross texture.

lightHorizontal = "LightHorizontal"

Represents light horizontal texture.

lightTrellis = "LightTrellis"

Represents light diagonal-cross texture.

lightVertical = "LightVertical"

Represents light vertical texture.

none = "None"

Represents that there's no texture.

percent10 = "Percent10"

Represents 10 percent texture.

percent12Pt5 = "Percent12Pt5"

Represents 12.5 percent texture.

percent15 = "Percent15"

Represents 15 percent texture.

percent20 = "Percent20"

Represents 20 percent texture.

percent25 = "Percent25"

Represents 25 percent texture.

percent30 = "Percent30"

Represents 30 percent texture.

percent35 = "Percent35"

Represents 35 percent texture.

percent37Pt5 = "Percent37Pt5"

Represents 37.5 percent texture.

percent40 = "Percent40"

Represents 40 percent texture.

percent45 = "Percent45"

Represents 45 percent texture.

percent5 = "Percent5"

Represents 5 percent texture.

percent50 = "Percent50"

Represents 50 percent texture.

percent55 = "Percent55"

Represents 55 percent texture.

percent60 = "Percent60"

Represents 60 percent texture.

percent62Pt5 = "Percent62Pt5"

Represents 62.5 percent texture.

percent65 = "Percent65"

Represents 65 percent texture.

percent70 = "Percent70"

Represents 70 percent texture.

percent75 = "Percent75"

Represents 75 percent texture.

percent80 = "Percent80"

Represents 80 percent texture.

percent85 = "Percent85"

Represents 85 percent texture.

percent87Pt5 = "Percent87Pt5"

Represents 87.5 percent texture.

percent90 = "Percent90"

Represents 90 percent texture.

percent95 = "Percent95"

Represents 95 percent texture.

solid = "Solid"

Represents solid texture.