I insert an image into an Excel range like so:
private System.Drawing.Image _logo;
public ProduceUsageRpt(..., System.Drawing.Image logo)
{
. . .
_logo = logo;
}
. . .
var logoRange = _xlSheet.Range[
_xlSheet.Cells[LOGO_FIRST_ROW, _grandTotalsColumn], _xlSheet.Cells[LOGO_LAST_ROW, _grandTotalsColumn]];
Clipboard.SetDataObject(_logo, true);
_xlSheet.Paste(logoRange, _logo);
Unfortunately, the image is too large for that range (currently row 1 to row 4, column 16). Instead of doing the polite thing and scaling itself down to fit the prescribed bounds, it spills out and over its assigned vertical and horizontal spot.
How can I get the image to scale down and restrict itself to its "box"?
I got the answer from adapting one at a related question here.
As long as I make the range large enough, this works: