Method SetImageAlternativeText
SetImageAlternativeText(WordDocument, ImageRef, string?, string?)
Sets a picture's alternative text and its title, as Word's Alt Text pane does.
public static DocumentEdit SetImageAlternativeText(this WordDocument document, ImageRef image, string? description, string? title)
Parameters
documentWordDocumentThe document that holds the picture.
imageImageRefThe picture.
descriptionstringThe alternative text; null or empty for none.
titlestringThe title; null or empty for none.
Returns
- DocumentEdit
The edit; Before is just before the picture and After just past it. The values the picture already has give an empty edit.
Exceptions
- ArgumentNullException
documentorimageis null.- ArgumentException
The picture is not in
document, or not in a paragraph; a text has a character XML cannot carry (a control character other than a tab or a line break, a lone surrogate).- InvalidOperationException
The picture's drawing is not one DrawingML picture, or it is in a shape's text box.