In the Microsoft news group, I saw a post from jizira asking how to put users' photos in Excel.
I thought it should be very simple, so I first recorded a macro and the result is:
ActiveSheet. Pictures. Insert ("D: t.bmp"). Select
However, in C #, the WorkSheet class does not directly support methods such as Pictures. Insert. In MSDN
On the website, several Office development documents introduce common Application, WorkBook, and Sheet
Like how to read and write. Finally, after reading the help of VBA, we found the solution, which is still very simple:
Excel. Worksheet xSheet = (Excel. Worksheet) xBook. Sheets [1];
XSheet. Shapes. AddPicture ("D: \ tt.bmp", MsoTriState. msoFalse,
MsoTriState. msoTrue, 10, 150,150 );
You can. The second and third parameters indicate whether to link to the file and whether to save the image in the file.
Information (or only save the link information ).