DocPicture module

class DocPicture.DocPicture

Bases: ShapeObject, IPicture

Represents a picture in a document.

AddCaption(name: str, numberingFormat: CaptionNumberingFormat, captionPosition: CaptionPosition) IParagraph

Adds a caption for the current picture. :param name: The name of the caption. :param numberingFormat: The numbering format of the caption. :param captionPosition: The position of the caption. :return: The paragraph object representing the added caption.

property BiLevel: bool

Gets or sets a value indicating whether the picture is in bi-level.

Returns:

True if the picture is in bi-level, False otherwise.

Return type:

bool

property Brightness: float

Gets or sets the brightness of the picture.

Returns:

The brightness of the picture.

Return type:

float

property CharacterFormat: CharacterFormat

Gets the character format of the shape object. :return: The character format of the shape object.

property Color: PictureColor

Gets picture color.

property Contrast: float

Gets or sets the contrast of the picture.

Returns:

The contrast of the picture.

Return type:

float

property DocumentObjectType: DocumentObjectType

Gets the type of the document object.

Returns:

The type of the document object.

Return type:

DocumentObjectType

property GrayScale: bool

Gets or sets a value indicating whether the picture is in grayscale.

Returns:

True if the picture is in grayscale, False otherwise.

Return type:

bool

property Height: float

Gets or sets the height of the picture.

Returns:

The height of the picture.

Return type:

float

property HeightScale: float

Gets or sets the height scale of the picture.

Returns:

The height scale of the picture.

Return type:

float

property HorizontalAlignment: ShapeHorizontalAlignment

Gets the horizontal alignment of the picture. :return: The horizontal alignment of the picture.

property HorizontalOrigin: HorizontalOrigin

Gets horizontal origin of the picture.

property HorizontalPosition: float

Gets absolute horizontal position of the picture.

property ImageBytes

Gets the image byte array.

Returns:

The image byte array.

Return type:

bytes

property IsCrop: bool

Gets whether the picture object is cropped.

property IsUnderText: bool

Gets whether the picture is below the text. :return: True if the picture is below the text, False otherwise.

property LayoutInCell: bool

Gets whether a picture in a table is displayed inside or outside the table. :return: True if the picture is displayed inside the table, False otherwise.

LoadImage

Loads the image from a file. :param imgFile: The path of the image file.

ReplaceImage(imageBytes: bytes, bIsKeepRation: bool)

Replaces the image with a new image. :param imageBytes: The byte array containing the new image data. :param bIsKeepRation: True to keep the original aspect ratio of the image, False otherwise.

property Rotation: float

Gets or sets the rotation of the picture.

Returns:

The rotation of the picture.

Return type:

float

SetScale

Scales the image by the specified scale factor.

Parameters:

scaleFactor (float) – The scale factor to apply.

property TextWrappingStyle: TextWrappingStyle

Gets text wrapping style of the picture.

property TextWrappingType: TextWrappingType

Gets text wrapping type of the picture.

property Title: str

Gets the title of the picture. :return: The title of the picture.

property TransparentColor: Color

Gets transparent color.

property VerticalAlignment: ShapeVerticalAlignment

Gets the vertical alignment of the picture. :return: The vertical alignment of the picture.

property VerticalOrigin: VerticalOrigin

Gets absolute horizontal position of the picture.

property VerticalPosition: float

Gets absolute vertical position of the picture.

property Width: float

Gets or sets the width of the picture.

Returns:

The width of the picture.

Return type:

float

property WidthScale: float

Gets or sets the width scale of the picture.

Returns:

The width scale of the picture.

Return type:

float