How to insert photos into Excel in C #

xiaoxiao2021-03-06  91

In the Microsoft News Group, I saw a post of Ji Nila, asking how to put the user photos in Excel.

I thought it should be very simple, so I first recorded a macro, the result of getting:

Activesheet.Pictures.Insert ("D: /TT.BMP"). SELECT

However, in C #, Worksheet does not directly support the method of Pictures.Isert. In MSDN

On the website, several office development documents are only common Application, Workbook, Sheet these pairs

How to read and write. Finally, I still have to see the help of VBA, I found a solution, and it is still very simple:

Excel.Worksheet Xsheet = (Excel.Worksheet) xbook.sheets [1]; xsheet.shapes.addpicture ("D: //tt.bmp", msotristate.msofalse, msotristate.msotrue, 10, 10, 150, 150);

Yes. Among them, second, three parameters indicate whether to link to the file, whether to save pictures in the document

Information (still only saving link information).

转载请注明原文地址:https://www.9cbs.com/read-107592.html

New Post(0)