有没有一种方法可以将位图列表保存到word或excel文件中

时间:2019-04-02 18:17:29

标签: c# wpf datamatrix

我有此对象的列表:

        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
        }

是否可以用该列表填充word / excel文件?

问题在于,要使用DocX插入图片,您需要提供图片的网址,并且在对象列表中有位图图片

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

#import csv
#import sys

#csv.field_size_limit(sys.maxsize)


inp = open("city2", "r")
inp2 = open("op", "r")
oup = open("op_mod.csv", "a+")





#alldata = []
count = 0 
for line in inp2:
  check = 0
  if count == 0:
    count = count + 1
    colline = line + "\t" + "cities"
    oup.write(colline)
    continue
  for city in inp:
    if city in line:
      print(city, line)
      linemod = line + "\t" + city #adding new value to an existing row
      #alldata.append(linemod)
      oup.write(linemod) #writing the new value
      check = 1
      break
  if check == 0:
    check = 1
    #oup.write(line)
    #alldata.append(line)
  inp.close()
  inp = open("city2", "r")

#writer.writerows(alldata)  
inp.close()
inp2.close()
oup.close()


0 个答案:

没有答案