I'm working with EPPlus.dll / v4.5.3 a long time. Now I've an update on my ducument and have to add a picture to header of my Excel-File.
I've tried a lot of versions, but without success.
Thats ist my code:
Code: Select all
asm := Clr_LoadLibrary(A_ScriptDir "\lib\epplus\lib\net40\EPPlus.dll")
pck := Clr_CreateObject(asm, "OfficeOpenXml.ExcelPackage")
ws := pck.Workbook.Worksheets.Add("Sheet1")
drawing := Clr_LoadLibrary("System.Drawing")
pic := Clr_CreateObject(drawing, "System.Drawing.Bitmap", "C:\Windows\Web\Wallpaper\Windows\img0.jpg")
ws.HeaderFooter.OddHeader.CenteredText := " After"
;img := ws.HeaderFooter.EvenFooter.InsertPicture(new FileInfo(A_ScriptDir "\99_Konfig\Logo.jpg"), PictureAlignment.Left)
img := ws.HeaderFooter.OddHeader.LeftAlignedText.InsertPicture(pic, PictureAlignment.Left)
img.Title := "Test: "
lib := Clr_LoadLibrary("mscorlib")
outfile := Clr_CreateObject(lib, "System.IO.FileInfo", "ttt.xlsx")
pck.SaveAs(outfile)
ExitApp
Inserting Picture into Sheet ist possible with:
Code: Select all
drawing := Clr_LoadLibrary("System.Drawing")
img := Clr_CreateObject(drawing, "System.Drawing.Bitmap", "C:\Windows\Web\Wallpaper\Windows\img0.jpg")
picture := Worksheet.Drawings.AddPicture("myPicture", img)
picture.SetPosition(60, 40)
picture.From.Column := 5
picture.From.Row := 5
picture.SetSize(100) ; 100%
https://searchcode.com/codesearch/raw/28145283/
https://stackoverflow.com/questions/11588704/adding-images-into-excel-using-epplus
and a lot of other.
I would be grateful, if someone could help