Documentazione HotXLS

TXLSXImage e TXLSXImages classes

TXLSXImages is the worksheet image collection exposed by TXLSXWorksheet.Images e each TXLSXImage carries image bytes, format e drawing anchor geometry

Declarations

type
  TXLSXImageFillMode = (xlsxImageFillStretch, xlsxImageFillTile);

  TXLSXImage = class
    procedure Assign(Source: TXLSXImage);
    procedure Scale(APercent: Double; AKeepAspect: Boolean = True);
    procedure ClearPreservedXml;
    property Row, Col: Integer;
    property WidthEMU, HeightEMU: Integer;
    property WidthInch, HeightInch: Double;
    property WidthCM, HeightCM: Double;
    property WidthPt, HeightPt: Double;
    property Format: TXLSXImageFormat;
    property Data: AnsiString;
    property AnchorType: TXLSXAnchorEditAs;
    property CropLeft, CropTop, CropRight, CropBottom: Double;
    property Transparency, Brightness, Contrast: Double;
    property Rotation: Double;
    property AltText: WideString;
    property AltTextTitle: WideString;
    property FillMode: TXLSXImageFillMode;
    property HasPreservedXml: Boolean;
  end;

  TXLSXImages = class
    function Add: TXLSXImage; overload;
    function Add(Source: TXLSXImage): Integer; overload;
    function FindAt(ARow, ACol: Integer): TXLSXImage;
    function DeleteAt(ARow, ACol: Integer): Boolean;
    function DeleteInRange(ARow1, ACol1, ARow2, ACol2: Integer): Integer;
    property Items[Index: Integer]: TXLSXImage; default;
  end;

Key members

Row and ColOne-based top-left anchor cell
WidthEMU and HeightEMUNative drawing dimensions in English Metric Units
WidthInch, WidthCM and WidthPtConvenience geometry views that update the underlying EMU dimensions
AnchorTypeSelects move e size with cells, move only, o absolute drawing behaviour
CropLeft, CropTop, CropRight and CropBottomTrova l'immagine ancorata alla coordinata di una cella in base 1
TransparencyTrasparenza uniforme dell'immagine da 0 a 100 percento
Brightness and ContrastRegolazioni di luminosità da -100 a 100 percento
RotationRotazione della forma in senso orario, in gradi, limitata all'intervallo da -360 a 360
AltTextTesto alternativo di accessibilità per l'immagine, usato da screen reader e strumenti assistivi
AltTextTitleAccessible title for the picture
FillModeStira l'immagine una volta sola o la ripete a mosaico sulla forma
HasPreservedXml and ClearPreservedXmlIspeziona o scarta il DrawingML importato, a prova di modifica, per una singola immagine
FindAtTrova l'immagine ancorata alla coordinata di una cella in base 1

Esempio

var Image: TXLSXImage;
begin
  Image := Sheet.Images.Add;
  Image.Row := 2;
  Image.Col := 4;
  Image.Data := PngBytes;
  Image.Format := xlsxImagePng;
  Image.WidthCM := 6;
  Image.AnchorType := xaOneCell;
  Image.CropLeft := 12.5;
  Image.Transparency := 20;
  Image.Brightness := 10;
  Image.Contrast := -5;
  Image.FillMode := xlsxImageFillStretch;
  Image.Rotation := 15;
end;

Vedere also