Table of Contents

Method SetImageRotation

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

SetImageRotation(WordDocument, ImageRef, int, bool, bool)

Sets a picture's rotation and whether it is mirrored, as Word's Rotate menu does.

public static DocumentEdit SetImageRotation(this WordDocument document, ImageRef image, int rotation, bool flipHorizontal, bool flipVertical)

Parameters

document WordDocument

The document that holds the picture.

image ImageRef

The picture.

rotation int

The rotation in 60000ths of a degree, clockwise; any value, taken as the angle it is (-5400000 is 16200000).

flipHorizontal bool

Whether the picture is mirrored left to right.

flipVertical bool

Whether the picture is mirrored top to bottom.

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.

Remarks

The picture is mirrored first and then turned about its centre. Its size and position stay; the box it is laid out in is its own turned by the nearest quarter turn, so a picture turned between 45 and 135 degrees (or 225 and 315) takes a line as tall as it is wide, as in Word (WQ-0126).

Exceptions

ArgumentNullException

document or image is null.

ArgumentException

The picture is not in document, or not in a paragraph.

InvalidOperationException

The picture's drawing is not one DrawingML picture with a transform, or it is in a shape's text box.