Skip to content

Shapes ​

Use shapeBgFillColor to set a Word shape's fill color from a template value.

Set a shape's fill color ​

  1. Add a shape to the document in Word.
  2. Open the shape's Edit Alt Text field.
  3. Enter the template action in the Alt Text:
text
{{shapeBgFillColor .ShapeColor}}

Provide the color in the values passed to Apply:

go
templateValues := struct {
    ShapeColor string
}{
    ShapeColor: "00AAFF",
}

The color must be a six-digit hexadecimal RGB value. A leading # is optional. For example, use FF0000 or #FF0000 for red. The color can also be hard-coded in the action:

text
{{shapeBgFillColor "FF0000"}}