-
-
Notifications
You must be signed in to change notification settings - Fork 39
addImage
Julian Halliwell edited this page Aug 12, 2025
·
9 revisions
Adds an image to a spreadsheet.
addImage( workbook, filepath, anchor );
addImage( workbook, imageData, imageType, anchor );
-
workbookspreadsheet object -
filepathstring: absolute path to the image file OR -
imageDataimage object AND -
imageTypestring: Possible values: "dib", "emf, "jpeg", "jpg", "pict", "png", "wmf" -
anchorstring: 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]
Chainable? Yes.
- 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.
- The
endRowandendColumnvalues are not inclusive and therefore should be higher than thestartRowandstartColumnvalues. Your image will not appear if the start and end values are the same.
spreadsheet = New spreadsheet();
workbook = spreadsheet.new();
path = "c:/temp/picture.png";
spreadsheet.addImage( workbook=workbook, filepath=path, anchor="1,1,2,2" );// place in A1 (first column, first row).