API Reference
WordImage
Represents an image contained in a WordDocument and provides functionality to insert and manipulate pictures.
Inheritance
- WordElement
- WordImage
Constructors
public WordImage(WordDocument document, WordParagraph paragraph, Uri externalUri, Double width, Double height, WrapTextImage wrapImage = InLineWithText, String description = "", Nullable<ShapeTypeValues> shape = null, Nullable<BlipCompressionValues> compressionQuality = null) #Initializes a new image from a file path.
Parameters
- document OfficeIMO.Word.WordDocument
- paragraph OfficeIMO.Word.WordParagraph
- filePath System.String
- width System.Nullable{System.Double}
- height System.Nullable{System.Double}
- wrapImage OfficeIMO.Word.WrapTextImage = InLineWithText
- description System.String = ""
- shape System.Nullable{DocumentFormat.OpenXml.Drawing.ShapeTypeValues} = null
- compressionQuality System.Nullable{DocumentFormat.OpenXml.Drawing.BlipCompressionValues} = null
public WordImage(WordDocument document, WordParagraph paragraph, String base64String, String fileName, Nullable<Double> width, Nullable<Double> height, WrapTextImage wrapImage = InLineWithText, String description = "", Nullable<ShapeTypeValues> shape = null, Nullable<BlipCompressionValues> compressionQuality = null) #Initializes a new image from a stream.
Parameters
- document OfficeIMO.Word.WordDocument
- paragraph OfficeIMO.Word.WordParagraph
- imageStream System.IO.Stream
- fileName System.String
- width System.Nullable{System.Double}
- height System.Nullable{System.Double}
- wrapImage OfficeIMO.Word.WrapTextImage = InLineWithText
- description System.String = ""
- shape System.Nullable{DocumentFormat.OpenXml.Drawing.ShapeTypeValues} = null
- compressionQuality System.Nullable{DocumentFormat.OpenXml.Drawing.BlipCompressionValues} = null
WordImage(OfficeIMO.Word.WordDocument document, OfficeIMO.Word.WordParagraph paragraph, System.String base64String, System.String fileName, System.Nullable{System.Double} width, System.Nullable{System.Double} height, OfficeIMO.Word.WrapTextImage wrapImage, System.String description, System.Nullable{DocumentFormat.OpenXml.Drawing.ShapeTypeValues} shape, System.Nullable{DocumentFormat.OpenXml.Drawing.BlipCompressionValues} compressionQuality) #Initializes a new image from a base64 string.
Parameters
- document OfficeIMO.Word.WordDocument
- paragraph OfficeIMO.Word.WordParagraph
- base64String System.String
- fileName System.String
- width System.Nullable{System.Double}
- height System.Nullable{System.Double}
- wrapImage OfficeIMO.Word.WrapTextImage
- description System.String
- shape System.Nullable{DocumentFormat.OpenXml.Drawing.ShapeTypeValues}
- compressionQuality System.Nullable{DocumentFormat.OpenXml.Drawing.BlipCompressionValues}
WordImage(OfficeIMO.Word.WordDocument document, OfficeIMO.Word.WordParagraph paragraph, System.Uri externalUri, System.Double width, System.Double height, OfficeIMO.Word.WrapTextImage wrapImage, System.String description, System.Nullable{DocumentFormat.OpenXml.Drawing.ShapeTypeValues} shape, System.Nullable{DocumentFormat.OpenXml.Drawing.BlipCompressionValues} compressionQuality) #Initializes an image linked to an external URI.
Parameters
- document OfficeIMO.Word.WordDocument
- paragraph OfficeIMO.Word.WordParagraph
- externalUri System.Uri
- width System.Double
- height System.Double
- wrapImage OfficeIMO.Word.WrapTextImage
- description System.String
- shape System.Nullable{DocumentFormat.OpenXml.Drawing.ShapeTypeValues}
- compressionQuality System.Nullable{DocumentFormat.OpenXml.Drawing.BlipCompressionValues}
public WordImage(WordDocument document, Drawing drawing) #Wraps an existing drawing as a WordImage.
Parameters
- document OfficeIMO.Word.WordDocument
- drawing DocumentFormat.OpenXml.Wordprocessing.Drawing
WordImage(OfficeIMO.Word.WordDocument arg1, DocumentFormat.OpenXml.Wordprocessing.Paragraph arg2, DocumentFormat.OpenXml.Wordprocessing.Run arg3, DocumentFormat.OpenXml.Vml.Shape arg4) #Wraps an existing VML image as a WordImage.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 DocumentFormat.OpenXml.Wordprocessing.Paragraph
- arg3 DocumentFormat.OpenXml.Wordprocessing.Run
- arg4 DocumentFormat.OpenXml.Vml.Shape
Methods
public WordImage Clone(WordParagraph paragraph) #WordImageCreates a copy of this image and appends it to the specified paragraph. The cloned image shares the same underlying image part.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- The paragraph to append the cloned image to.
Returns
The newly created WordImage instance.
public Byte[] GetBytes() #Byte[]Retrieves the image data as a byte array.
Returns
Bytes representing the image.
public Stream GetStream() #StreamRetrieves the image data as a stream without loading the entire image into memory.
Returns
A Stream for reading the image bytes.
public Void SaveToFile(String fileToSave) #VoidExtract image from Word Document and save it to file
Parameters
- fileToSave System.String
SetPictureLock(System.Action{DocumentFormat.OpenXml.Drawing.PictureLocks} arg1) #Sets picture lock property using provided action.
Parameters
- arg1 System.Action{DocumentFormat.OpenXml.Drawing.PictureLocks}
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public HorizontalPosition horizontalPosition { get; set; } #Get or set the Image's horizontal position.
public VerticalPosition verticalPosition { get; set; } #Get or set the Image's vertical position.
public Nullable<BlipCompressionValues> CompressionQuality { get; set; } #Gets or sets the compression quality for embedded images.
public String RelationshipId { get; } #Gets the relationship id of the embedded image.
public String ExternalRelationshipId { get; } #Gets the relationship id of an externally linked image, if any.
public Boolean IsExternal { get; } #Indicates whether the image is stored outside the package.
public Uri ExternalUri { get; } #Gets the URI of the externally linked image.
public String FilePath { get; set; } #Gets or sets the file path or name for the image.
public String FileName { get; set; } #Get or sets the image's file name
public String Description { get; set; } #Gets or sets the image's description.
public Nullable<Double> Width { get; set; } #Gets or sets Width of an image
public Nullable<Double> Height { get; set; } #Gets or sets Height of an image
public Nullable<Double> EmuWidth { get; } #Gets the image width in EMUs.
public Nullable<Double> EmuHeight { get; } #Gets the image height in EMUs.
public Nullable<ShapeTypeValues> Shape { get; set; } #Gets or sets the shape type used to display the image.
public Nullable<BlackWhiteModeValues> BlackWiteMode { get; set; } #Microsoft Office does not seem to fully support this attribute, and ignores this setting. More information: http://officeopenxml.com/drwSp-SpPr.php
public Nullable<Boolean> VerticalFlip { get; set; } #Gets or sets whether the image is vertically flipped.
public Nullable<Boolean> HorizontalFlip { get; set; } #Gets or sets whether the image is horizontally flipped.
public Nullable<Int32> Rotation { get; set; } #Gets or sets the image rotation in degrees.
public Nullable<Int32> CropTop { get; set; } #Gets or sets the number of EMUs to crop from the top of the image.
public Nullable<Int32> CropBottom { get; set; } #Gets or sets the number of EMUs to crop from the bottom of the image.
public Nullable<Int32> CropLeft { get; set; } #Gets or sets the number of EMUs to crop from the left side of the image.
public Nullable<Int32> CropRight { get; set; } #Gets or sets the number of EMUs to crop from the right side of the image.
public Nullable<Double> CropTopCentimeters { get; set; } #Gets or sets the number of centimeters to crop from the top of the image.
public Nullable<Double> CropBottomCentimeters { get; set; } #Gets or sets the number of centimeters to crop from the bottom of the image.
public Nullable<Double> CropLeftCentimeters { get; set; } #Gets or sets the number of centimeters to crop from the left side of the image.
public Nullable<Double> CropRightCentimeters { get; set; } #Gets or sets the number of centimeters to crop from the right side of the image.
public Nullable<Int32> Transparency { get; set; } #Gets or sets the image transparency percentage (0-100).
public Nullable<WrapTextImage> WrapText { get; set; } #Gets or sets the image's wrap text.
public ImageFillMode FillMode { get; set; } #Gets or sets how the image should fill its bounding box. Default is Stretch.
public Nullable<Boolean> UseLocalDpi { get; set; } #Specifies whether to use the image's local DPI setting when rendering.
public ValueTuple<Int32, Int32> Location { get; } #Gets the anchor location of the image.
public Nullable<Boolean> PreferRelativeResize { get; set; } #Indicates whether resizing should be relative to the original size.
public Nullable<Boolean> NoChangeAspect { get; set; } #Gets or sets whether the aspect ratio is locked.
public Nullable<Boolean> NoCrop { get; set; } #Gets or sets whether the image cannot be cropped.
public Nullable<Boolean> NoMove { get; set; } #Gets or sets whether the image is locked from moving.
public Nullable<Boolean> NoResize { get; set; } #Gets or sets whether the image cannot be resized.
public Nullable<Boolean> NoRot { get; set; } #Gets or sets whether the image cannot be rotated.
public Nullable<Boolean> NoSelect { get; set; } #Gets or sets whether the image cannot be selected.
public Nullable<Int32> FixedOpacity { get; set; } #Sets a fixed opacity value for the image.
public String AlphaInversionColorHex { get; set; } #Gets or sets the alpha inversion color in hex.
public Nullable<Color> AlphaInversionColor { get; set; } #Gets or sets the alpha inversion color.
public Nullable<Int32> BlackWhiteThreshold { get; set; } #Gets or sets the threshold for black and white effect.
public Nullable<Int32> BlurRadius { get; set; } #Gets or sets the blur radius in EMUs.
public Nullable<Boolean> BlurGrow { get; set; } #Gets or sets whether the blur grows the image's bounds.
public String ColorChangeFromHex { get; set; } #Gets or sets the source color to change from in hex.
public String ColorChangeToHex { get; set; } #Gets or sets the target color to change to in hex.
public Nullable<Color> ColorChangeFrom { get; set; } #Gets or sets the source color to change from.
public Nullable<Color> ColorChangeTo { get; set; } #Gets or sets the target color to change to.
public String ColorReplacementHex { get; set; } #Gets or sets a color replacement hex value.
public Nullable<Color> ColorReplacement { get; set; } #Gets or sets a color replacement.
public String DuotoneColor1Hex { get; set; } #Gets or sets the first duotone color in hex.
public String DuotoneColor2Hex { get; set; } #Gets or sets the second duotone color in hex.
public Nullable<Color> DuotoneColor1 { get; set; } #Gets or sets the first duotone color.
public Nullable<Color> DuotoneColor2 { get; set; } #Gets or sets the second duotone color.
public Nullable<Boolean> GrayScale { get; set; } #Gets or sets whether the image is displayed in grayscale.
public Nullable<Int32> LuminanceBrightness { get; set; } #Gets or sets the brightness adjustment.
public Nullable<Int32> LuminanceContrast { get; set; } #Gets or sets the contrast adjustment.
public Nullable<Int32> TintAmount { get; set; } #Gets or sets the tint amount.
public Nullable<Int32> TintHue { get; set; } #Gets or sets the tint hue.