I am trying to insert an image into a worksheet and scale it so that the width of the image is the same as that of the cell.
var range = ws.Range[5, 2];
var pic = ws.Pictures.AddPicture(range.Row, range.Column, @"D:\Pictures\clouds.JPG");
int scale = (int)(range.ColumnWidth / pic.Width);
This results in a scale factor of 0, because as far as I can tell, the scale factors have to be integers and in percents. The use of integers for dimensions throughout the shapes functionality seemed a bit weird, but having integer scale factors is just bizarre.
Just to test it, I tried setting the picture width to the column width.
pic.Width = (int)range.ColumnWidth;
This is completely different when I open up the test file... See the attached image.
I can't say I have been very happy with the functionality for shapes in Excel so far, but if you could help it would be much appreciated :)