问题
Let's assume I have a worksheet named sheet1
which contain a picture named pic_001
How can I get this picture as System.Drawing.Image
object.
回答1:
OK I found out how to:
public static Image GetImage(string sheetname, ExcelPackage excelFile)
{
var sheet = excelFile.Workbook.Worksheets[sheetname];
var pic = sheet.Drawings["pic_001"] as ExcelPicture;
return pic.Image;
}
回答2:
all xlsx files are really zip files. you can copy/rename the .xlsx extension to .zip and navigate the folder hierarchy yourself. navigate to xl/media to see your images. there are certainly more efficient ways of doing this, but this is a quick and dirty solution that will get the job done.
来源:https://stackoverflow.com/questions/36457242/how-to-get-read-picture-from-excel-file-xlsx-using-epplus