How to do this programmatically in C#? I´m using MS Office Professional 2016
To insert an image I use this code:
DialogResult result;
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Choose image file";
result = ofd.ShowDialog();
if (result == DialogResult.OK)
{
//GetInstance().ActiveSheet.Shapes.AddPicture(ofd.FileName, MsoTriState.msoFalse, MsoTriState.msoCTrue, 10, 10, -1, -1);
GetInstance().ActiveSheet.Shapes.AddPicture2(ofd.FileName, MsoTriState.msoFalse, MsoTriState.msoCTrue, 10, 10, -1, -1, 1);
Excel.Shape newShape = GetInstance().ActiveSheet.Shapes.Item(GetInstance().ActiveSheet.Shapes.Count);
newShape.ZOrder(MsoZOrderCmd.msoSendToBack);
newShape.Placement = Excel.XlPlacement.xlMoveAndSize;
}
Then I have my images as shapes. Maybe there is a way to do the picture compression on shapes?