我正在编写代码以将单元格中的单元格和图片/图像从 Excel 文档中提取到数据库中。
使用此代码,我可以获得不是图片的单元格值。
但是,Cell 对象中没有图片。请注意,每一行都以图像开头。
A1- Picture
B1- Text
C1- Text and so on.
如何从“A”列获取图像?
WorkbookPart wbPart = document.WorkbookPart;
var workSheet = wbPart.WorksheetParts.FirstOrDefault();
foreach (Row r in workSheet.Worksheet.Descendants<Row>())
{
//Note only has Colum B,C. Not A as A has an image???
foreach(Cell c in r.ChildElements)
{
foreach(object o in c.ChildElements)
{
Console.WriteLine(c.CellReference + " " + o.ToString());
}
}
}