Seltsames Verhalten beim Festlegen der Zeilenhöhe in EPPlus
Ich erstelle eine Excel-Datei mit EEPlus unter MVC-5 C #. Alles läuft wie geplant, bis ich eine Höhe in einer Reihe festgelegt habe (damit ein Bild passt).
Ich lade de Bilder und setze die Höhe in Spalte 20 wie folgt:
Image cfPhoto = null;
Bitmap cfBm = null;
ExcelPicture pictureCf = null;
var photoInitialColumn = 0;
i++;
completedFormPhotos.ForEach(delegate(CompletedFormPhoto cfP)
{
cfPhoto = Image.FromFile(HostingEnvironment.MapPath("~/Content/Images/FormPhotos/" + cfP.Id + ".jpg"));
cfBm = new Bitmap(cfPhoto, new Size(215, 170));
pictureCf = worksheet.Drawings.AddPicture(cfP.Id.ToString(), cfBm);
pictureCf.SetPosition(i+1, 0, photoInitialColumn, 10);
worksheet.Cells[_alpha[photoInitialColumn] + (i + 3) + ':' + _alpha[photoInitialColumn + 1] + (i + 3)].Merge = true;
worksheet.Cells[_alpha[photoInitialColumn] + (i + 3) + ':' + _alpha[photoInitialColumn + 1] + (i + 3)].Value = cfP.comment;
worksheet.Cells[_alpha[photoInitialColumn] + (i + 3) + ':' + _alpha[photoInitialColumn + 1] + (i + 3)].Style.WrapText = true;
photoInitialColumn += 2;
//HERE I SET THE HEIGHT. At this point, i == 18
worksheet.Row(i+2).Height = 180;
});
Aber ich habe ein Firmenlogo oben in der Excel-Datei (A1-Zelle), dessen Größe ebenfalls geändert wird (abhängig von der Höhe). Das ist so definiert:
Image _keyLogo = Image.FromFile(HostingEnvironment.MapPath("~/Content/Images/key_logo.png"));
var pictureLogo = worksheet.Drawings.AddPicture("Logo Key Quimica", _keyLogo);
pictureLogo.SetPosition(0, 0, 0, 0);
Resulting on this:
Jede Hilfe wäre sehr dankbar.
Hie ist die betreffende Excel-Datei.