首页 > 解决方案 > 有没有办法将位图列表保存到 word 或 excel 文件中

问题描述

我有这个对象的列表:

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

有没有办法用该列表填充 word/excel 文件?

问题是要使用 DocX 插入图像,您需要提供图像的 url,并且我们在对象列表中有位图图像

我已经尝试将每个图像保存到特定路径中,然后每次都读取它,但是尝试覆盖每个图像并将其保存到同一个文档时出现问题。

        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
        }

标签: c#wpfdatamatrix

解决方案


推荐阅读