Table of Contents

Method SetImageAlternativeText

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

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

document WordDocument

The document that holds the picture.

image ImageRef

The picture.

description string

The alternative text; null or empty for none.

title string

The 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

document or image is 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.