0

I've got a list of this object:

public class SerialMatrix
{
    public string SerialNumber { get; set; }
    public Image DataMatrix { get; set; }
}

Is there a way to populate a word/excel file with that list?

The problem is that to insert a Image using DocX you need to give the url of the Image and we have the bitmap Image in the object list

I already tried to save each image into a specific path and then read it every time but there's a problem trying to overwrite each image and saving it to the same doc.

        foreach (var item in serialNumbers)
        {
            dataImage = GenerateMatrix(item); //here I generate the datamatrix
            objeto.SerialNumber = item; //add the serialnumber to the object
            objeto.DataMatrix = dataImage; //add the image(bitmap) to the object
            objectlist.Add(objeto); //add the object to my list of objects
        }
Steve Py
  • 26,149
  • 3
  • 25
  • 43
HiramL.
  • 3
  • 5
  • The overwrite problem can easily be solved. Just search StackOverflow, e.g. for "c# overwrite image file". Besides that, is DataMatrix a WPF Image element, or a System.Drawing.Image? – Clemens Apr 02 '19 at 18:29
  • the DataMatrix it's a System.Drawing.Bitmap – HiramL. Apr 02 '19 at 20:09

0 Answers0