How to insert photos into Excel in C #

xiaoxiao2021-03-06  27

In the Microsoft News Group, I saw a post of Ji Nila, asked how to put the user photos in Excel. I thought it should be very simple, so I recorded a macro. The result is: activesheet.pictures.insert ("d: /tt.bmp"). SELECT However, in C #, Worksheet does not directly support Pictures. INSERT This method. On the MSDN website, several Office development documents are intended to be common Application, Workbook, Sheet 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.msterche, 10, 10, 150, 150); it is possible. Among them, second, three parameters indicate whether to link to the file, whether to save image information in the document (or only the link information).

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

New Post(0)