XlsBitmapShape module

class XlsBitmapShape.XlsBitmapShape

Bases: XlsShape, IPictureShape

Represents a bitmap/picture shape in an Excel worksheet.

This class provides properties and methods for manipulating picture shapes in Excel, including image manipulation, cropping, and formatting. It extends XlsShape and implements the IPictureShape interface.

property BlipId: UInt32

Gets the blip identifier for the bitmap.

Returns:

The blip identifier for the bitmap.

Return type:

UInt32

property ColorFrom: Color

Gets or sets the starting color for gradient effect.

Returns:

The starting color for gradient effect.

Return type:

Color

property ColorTo: Color

Gets or sets the ending color for gradient effect.

Returns:

The ending color for gradient effect.

Return type:

Color

Compress(quality: int)

Compresses the picture quality to reduce file size.

Parameters:

quality (int) – Picture quality, range is 0-100 (higher values mean better quality).

property CropBottomOffset: int

Gets or sets the bottom cropping offset in pixels.

Returns:

The bottom cropping offset in pixels.

Return type:

int

property CropLeftOffset: int

Gets or sets the left cropping offset in pixels.

Returns:

The left cropping offset in pixels.

Return type:

int

property CropRightOffset: int

Gets or sets the right cropping offset in pixels.

Returns:

The right cropping offset in pixels.

Return type:

int

property CropTopOffset: int

Gets or sets the top cropping offset in pixels.

Returns:

The top cropping offset in pixels.

Return type:

int

Dispose()

Releases all resources used by the bitmap shape.

This method performs cleanup operations and releases memory resources used by the bitmap shape.

property FileName: str

Gets or sets the file name of the bitmap image.

Returns:

The file name of the bitmap image.

Return type:

str

Gets the hyperlink associated with the bitmap shape.

Returns:

An object representing the hyperlink associated with the bitmap shape.

Return type:

HyperLink

property IsCamera: bool

Gets or sets whether the bitmap is a camera object.

Returns:

True if the bitmap is a camera object; otherwise, False.

Return type:

bool

property IsDDE: bool

Gets or sets whether the bitmap is a DDE (Dynamic Data Exchange) object.

Returns:

True if the bitmap is a DDE object; otherwise, False.

Return type:

bool

property Macro: str

Gets or sets the macro associated with the bitmap shape.

Returns:

The macro associated with the bitmap shape.

Return type:

str

property Picture: Stream

Gets or sets the picture data as a stream.

Returns:

The picture data as a stream.

Return type:

Stream

property RefRange: str

Gets or sets the reference range for the bitmap shape.

Returns:

The reference range for the bitmap shape.

Return type:

str

Remove

Removes the bitmap shape from the worksheet.

Parameters:

removeImage (bool) – True to remove the underlying image data; False to keep it.

Sets a hyperlink for the bitmap shape.

Parameters:
  • linkString (str) – The URL or file path for the hyperlink.

  • isExternal (bool) – True if the link is to an external resource; False if it’s an internal link.

property ShapeType: ExcelShapeType

Gets the type of the shape.

Returns:

An enumeration value representing the type of the shape.

Return type:

ExcelShapeType