1

So what I'm trying todo is get these pictures and put them into the string builder.

        StringBuilder sb = new StringBuilder();
        Spire.Xls.Workbook workbook = new Spire.Xls.Workbook();
        workbook.LoadFromFile(Path.Combine(path, file));
        Spire.Xls.Worksheet sheet = workbook.Worksheets[0];
        Spire.Xls.Collections.PicturesCollection pictures = sheet.Pictures;
        for (i = 0; i < pictures.Count; i++)
        {
            sb.Append(@"<img src="+pictures[i]+ " />");
        }

1 Answers1

0

Try the following code:

StringBuilder sb = new StringBuilder();
Spire.Xls.Workbook workbook = new Workbook();
workbook.LoadFromFile(Path.Combine(path, file));
Spire.Xls.Worksheet sheet = workbook.Worksheets[0];
Spire.Xls.Collections.PicturesCollection pictures = sheet.Pictures;
for (int i = 0; i < pictures.Count; i++)
{
    string image_Path = "image" + (i + 1).ToString() + ".png";
    pictures[i].Picture.Save(image_Path, System.Drawing.Imaging.ImageFormat.Png);
    sb.Append(@"<img src=" + image_Path + "/>");
}
Dheeraj Malik
  • 703
  • 1
  • 4
  • 8