Skip to content
Julian Halliwell edited this page Apr 8, 2017 · 8 revisions

Adds an image to a spreadsheet.

addImage( workbook=workbook, filepath=filepath, anchor=anchor  );
addImage( workbook=workbook, imageData=imageData, imageType=imageType, anchor=anchor  );

Required arguments

  • workbook spreadsheet object
  • filepath string: absolute path to the image file OR
  • imageData image object AND
  • imageType string: Possible values: "dib", "emf, "jpeg", "jpg", "pict", "png", "wmf"
  • anchor string: Where to place the image expressed as a list of either 4 or 8 numbers:
  • [startRow],[startColumn],[endRow],[endColumn]
  • [startXPosition],[startYPosition],[endXPosition],[endYPosition],[startRow],[startColumn],[endRow],[endColumn]

Notes

The first anchor format specifies only the row and column numbers, the second also specifies the positions in the cell using pixel X and Y coordinates relative to the upper left corner of the cell. If you use the first format the image corner positions within the top left and bottom right cell are 0,0 and ,0,255.

Example

spreadsheet = New spreadsheet();
workbook = spreadsheet.new();
path = "c:/temp/picture.png";
spreadsheet.addImage( workbook=workbook, filepath=path, anchor="5,5,10,12" );
Clone this wiki locally