I'm trying to replace some picture in an excel files with some others but it's not working.
Can someone help me?
Thanks
- Code: Select all
ExcelSpire.Workbook workbook = new ExcelSpire.Workbook();
workbook.LoadFromFile(fo.mFile.FullName);
foreach (ExcelSpire.Worksheet w in workbook.Worksheets)
{
if (!w.HasPictures)
continue;
int ipic = 0;
List<ExcelSpire.Core.IPictureShape> pics = w.Pictures.ToList();
for (int ip = 0; ip < w.Pictures.Count; ip++)
{
ExcelSpire.ExcelPicture p = w.Pictures[ip];
if (p.ShapeType != ExcelSpire.ExcelShapeType.Picture)
continue;
try
{
string fileT = @"my file"
p.Picture = Image.FromFile(fileT);
}
catch (Exception ex)
{
mExceptions.Add(new Exception(fo.mFile.FullName, ex));
}
}
}