Header InsertPicture inserts an empty space instead

Jun 1, 2013 at 3:44 PM
I have the fallowing code that inserts a png picture into a the Header of a sheet.
The issue is that when I open the resultant xlsx in Excel2013 it shows an empty space with the same width and height as the inserted image but there is no image.
string docsPath = @"[path_to_files]";

var newFileInfo = new FileInfo(docsPath + @"\outout.xlsx");
var templateFileInfo = new FileInfo(docsPath + @"\template.xlsx");
var package = new ExcelPackage(newFileInfo, templateFileInfo);
var sheet = package.Workbook.Worksheets[1];

var qrcodeImage = new Bitmap(docsPath + @"\qrcode.png");
var img = sheet.HeaderFooter.OddHeader.InsertPicture(qrcodeImage, PictureAlignment.Right);
sheet.HeaderFooter.OddHeader.RightAlignedText =
    "&\"Arial,Regular\"&10Sample Header Text\r\n" +
    "&G\r\n" +
    "Date [&D]";
img.Title = "QrCode Image";
img.GrayScale = false;
img.BiLevel = false;
img.Gain = .5;
img.Gamma = .35;
img.Width = 100;
img.Height = 100;

I tried to insert the image manually in Excel and it shows fine.

Any suggestions?
Jun 2, 2013 at 9:22 AM
I managed to fix the issue by modifying "ExcelVmlDrawingPictureCollection.cs" and adding two lines of code:
internal ExcelVmlDrawingPicture Add(string id, Uri uri, string name, double width, double height)
    XmlNode node = AddImage(id, uri, name, width, height);
    var draw = new ExcelVmlDrawingPicture(node, NameSpaceManager, _ws);
    draw.ImageUri = uri;
    //-----Missing Code-----
    var rel = Part.CreateRelationship(PackUriHelper.GetRelativeUri(Uri, draw.ImageUri), TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
    draw.RelId = rel.Id;
    return draw;
Jun 3, 2014 at 2:49 AM
how can I do that if i'm not using C# instead ... i'm using Vb.net please?