Table of Contents

TExcelFile.SetImage Method

Overloads

TExcelFile.SetImage(Integer, TBytes)

Sets the image data for an existing image. It will try to automatically guess/convert the image type of the data to the better fit. Note that for SVG images, xlsx files store both a PNG and SVG image. To enter an SVG image, use SetImageAlternate

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetImage(const imageIndex: Integer; data: TBytes); overload;

Parameters

<-> Parameter Type Description
const imageIndex Integer Index of the image on the sheet array (1-based)
data TBytes Image data.

See also

TExcelFile.SetImage(Integer, TUIImage)

Sets the image data for an existing image. Note that for SVG images, xlsx files store both a PNG and SVG image. To enter an SVG image, use SetImageAlternate

Remarks

Saving a WMF or EMF Image is not currently supported by the .NET framework. If you pass a MetaFile to this method, it will be saved as PNG. For inserting a REAL wmf into excel use AddImage(TStream, TXlsImgType, IImageProperties)

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetImage(const imageIndex: Integer; const Img: TUIImage); overload;

Parameters

<-> Parameter Type Description
const imageIndex Integer Image Index. 1-Based.
const Img TUIImage Image to replace.

See also

TExcelFile.SetImage(Integer, TBytes, TXlsImgType)

Sets the image data and / or image properties of an existing image. Note that for SVG images, xlsx files store both a PNG and SVG image. To enter an SVG image, use SetImageAlternate

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetImage(const imageIndex: Integer; data: TBytes; const imageType: TXlsImgType); overload;

Parameters

<-> Parameter Type Description
const imageIndex Integer Index of the image on the sheet array (1-based)
data TBytes Image data.
const imageType TXlsImgType Image type of the new data.

See also

TExcelFile.SetImage(Integer, TBytes, Boolean, string)

Sets the image data for an existing image. It will try to automatically guess/convert the image type of the data to the better fit. Note that for SVG images, xlsx files store both a PNG and SVG image. To enter an SVG image, use SetImageAlternate

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetImage(const imageIndex: Integer; data: TBytes; const usesObjectIndex: Boolean; const objectPath: string); overload;

Parameters

<-> Parameter Type Description
const imageIndex Integer Index of the image on the sheet array (1-based)
data TBytes Image data.
const usesObjectIndex Boolean If false (the default) then imageIndex is an index to the list of images.
When true imageIndex is an index to the list of all objects in the sheet. When you have the object id, you can avoid calling ObjectIndexToImageIndex which is a slow method, by setting this parameter to true.
const objectPath string Path to the object, when the object is grouped with others. This parameter only has meaning if usesObjectIndex is true.

If it is "absolute"(it starts with "\"), then the path includes the objectIndex, and the objectIndex is not used. An object path of "\1\2\3" is exactly the same as using objectIndex = 1 and objectPath = "2\3"

See also

TExcelFile.SetImage(Integer, TUIImage, Boolean, string)

Sets the image data for an existing image. Note that for SVG images, xlsx files store both a PNG and SVG image. To enter an SVG image, use SetImageAlternate

Remarks

Saving a WMF or EMF Image is not currently supported by the .NET framework. If you pass a MetaFile to this method, it will be saved as png. For inserting a REAL wmf into excel use AddImage(TStream, TXlsImgType, IImageProperties)

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetImage(const imageIndex: Integer; const Img: TUIImage; const usesObjectIndex: Boolean; const objectPath: string); overload;

Parameters

<-> Parameter Type Description
const imageIndex Integer Image Index. 1-Based.
const Img TUIImage Image to replace.
const usesObjectIndex Boolean If false (the default) then imageIndex is an index to the list of images.
When true imageIndex is an index to the list of all objects in the sheet. When you have the object id, you can avoid calling ObjectIndexToImageIndex which is a slow method, by setting this parameter to true.
const objectPath string Path to the object, when the object is grouped with others. This parameter only has meaning if usesObjectIndex is true.

If it is "absolute"(it starts with "\"), then the path includes the objectIndex, and the objectIndex is not used. An object path of "\1\2\3" is exactly the same as using objectIndex = 1 and objectPath = "2\3"

See also

TExcelFile.SetImage(Integer, TBytes, TXlsImgType, Boolean, string)

Sets the image data and / or image properties of an existing image. Note that for SVG images, xlsx files store both a PNG and SVG image. To enter an SVG image, use SetImageAlternate

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetImage(const imageIndex: Integer; data: TBytes; const imageType: TXlsImgType; const usesObjectIndex: Boolean; const objectPath: string); overload; virtual; abstract;

Parameters

<-> Parameter Type Description
const imageIndex Integer Index of the image on the sheet array (1-based)
data TBytes Image data.
const imageType TXlsImgType Image type of the new data.
const usesObjectIndex Boolean If false (the default) then imageIndex is an index to the list of images.
When true imageIndex is an index to the list of all objects in the sheet. When you have the object id, you can avoid calling ObjectIndexToImageIndex which is a slow method, by setting this parameter to true.
const objectPath string Path to the object, when the object is grouped with others. This parameter only has meaning if usesObjectIndex is true.

If it is "absolute"(it starts with "\"), then the path includes the objectIndex, and the objectIndex is not used. An object path of "\1\2\3" is exactly the same as using objectIndex = 1 and objectPath = "2\3"

See also