-
-
Notifications
You must be signed in to change notification settings - Fork 36
addImage
Julian Halliwell edited this page Jun 13, 2023
·
8 revisions
Adds an image to a spreadsheet.
addImage( workbook, filepath, anchor );
addImage( workbook, imageData, imageType, anchor );
-
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]
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
endRow
andendColumn
values are not inclusive and therefore should be higher than thestartRow
andstartColumn
values. 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).