addImage - cfsimplicity/spreadsheet-cfml GitHub Wiki
Adds an image to a spreadsheet.
addImage( workbook, filepath, anchor );
addImage( workbook, imageData, imageType, anchor );
Required arguments
workbook
spreadsheet objectfilepath
string: absolute path to the image file ORimageData
image object ANDimageType
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.
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.
- 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.
Example
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).