I'm using SpreadSheetAddImage in ColdFusion 10 to add an image to the header are of my spreadsheet. The problem I'm running in to is the function takes an anchor position for example if I want to run the image from cell 1 row 1 to cell 5 row 5 I would supply "1,1,5,5" as the anchor argument. However if my table has small data in those cells the image gets crunched. How can I add the image with a set width and height?
SpreadsheetAddImage(excelSheet,"C:\myimagepath\excelReportHeaderImage.jpg","1,1,5,5");
Figured it out, thanks to the help from Leigh. In ColdFusion 10, here is what I did...
// Add our report header (must add AFTER the columns have been resized or it will reset the image size)
headerImageBytes = FileReadBinary(image_file_path);
headerImageIndex = poiWorkbook.addPicture( headerImageBytes, poiWorkbook.PICTURE_TYPE_JPEG );
helper = poiWorkbook.getCreationHelper();
drawing = poiSheet.createDrawingPatriarch();
anchor = helper.createClientAnchor();
anchor.setCol1(0);
anchor.setCol2(5);
anchor.setRow1(0);
anchor.setRow2(5);
picture = drawing.createPicture( anchor, headerImageIndex );
picture.resize();
Now the image shows in Cells A1:E5 and it is the TRUE size of the image. If you need to adjust the size, I believe you can pass in a scale into the resize method.