Method ReanchorImage
ReanchorImage(WordDocument, ImageRef, Paragraph, ImageAnchor)
Moves a floating picture's anchor to the start of another paragraph and gives it a position there, as dragging the picture does in Word (Phase 176, WQ-0157: the anchor goes to the paragraph at the picture's new top edge, at its start). One undo step.
public static DocumentEdit ReanchorImage(this WordDocument document, ImageRef image, Paragraph target, ImageAnchor anchor)
Parameters
documentWordDocumentThe document that holds the picture.
imageImageRefThe floating picture.
targetParagraphThe paragraph it is anchored to now.
anchorImageAnchorIts layout options there (the position the caller worked out for the new paragraph).
Returns
- DocumentEdit
The edit; After is just past the picture at its new place.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The picture or the paragraph is not in
document, or they are in different parts.- InvalidOperationException
The picture is not floating, or is in a shape's text box.