[]
Specifies how a background image is laid out within the destination rectangle.
Use this enum with BackgroundImageLayout to control how a range's background image is displayed. Supported layouts can stretch the image, center it, fit it while preserving its aspect ratio, or place it at the top-left corner without resizing. The default layout returned by BackgroundImageLayout is Stretch.
public enum BackgroundImageLayout
Public Enum BackgroundImageLayout
IRange range = worksheet.Range["A1:C3"];
byte[] backgroundImage = new byte[] {
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, 0xC4,
0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41,
0x54, 0x78, 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00,
0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, 0xB4,
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44,
0xAE, 0x42, 0x60, 0x82
};
range.BackgroundImage = backgroundImage;
range.BackgroundImageLayout = BackgroundImageLayout.Zoom;
| Name | Description |
|---|---|
| Center | Specifies to centre-align the image within the destination rectangle. |
| None | Specifies to left-align the image at the top across the destination rectangle. |
| Stretch | Specifies to resize the image to fill the destination dimensions. The aspect ratio is not preserved. |
| Zoom | Specifies to resize the image to fit in the destination dimensions while preserving the image’s native aspect ratio. |