public BitmapShape Add(Image image, MsoBlipType blipType, bool loadedFromExcelFile) { MsofbtBseRecord record = new MsofbtBseRecord { BlipType = blipType, Version = 2, RequiredWin = 6, Picture = new MsoBitmapPictureRecord() }; record.Picture.LoadedFromExcel = loadedFromExcelFile; record.Picture.Parent = record; record.Picture.Image = image; this.Worksheet.Parent.Pictures.Add(record); BitmapShape shape = new BitmapShape(this, image) { Child = record, Right = image.Width, Bottom = image.Height, Id = this.Worksheet.Parent.Pictures.Count }; this.items.Add(shape); return(shape); }
public BitmapShape Add(Image image, Rectangle rect, MsoBlipType blipType) { BitmapShape shape = this.Add(image, blipType, true); shape.Left = rect.Left; shape.Top = rect.Top; shape.Right = rect.Right; shape.Bottom = rect.Bottom; return(shape); }
protected override byte[] SetData(MsoDelayedRecords delayedRecords) { int length; OptimizedBuffer buffer = new OptimizedBuffer(); if (this.Image != null) { MemoryStream stream = new MemoryStream(); MsoBlipType blipType = (base.Parent as MsofbtBseRecord).BlipType; this.Image.Save(stream, ConvertBlipTypeToImageFormat(blipType)); this.ImageBytes = stream.GetBuffer(); length = (int)stream.Length; } else { length = this.ImageBytes.Length; } byte[] bytes = new MD5CryptoServiceProvider().ComputeHash(this.imageBytes); buffer.Write(bytes, 0, 0, bytes.Length); buffer.Write(0, bytes.Length); buffer.Write(this.imageBytes, bytes.Length + 1, 0, length); return(buffer.Buffer); }
public BitmapShape Add(Image image, MsoBlipType blipType) { return(this.Add(image, blipType, false)); }
internal void Add(Image image, Rectangle rect, MsoBlipType blipType) { this.AddImage(image, rect); this.Worksheet.Shapes.Add(image, rect, blipType); }
internal void Add(Image image, MsoBlipType blipType) { this.AddImage(image); this.Worksheet.Shapes.Add(image, blipType); }
public static ImageFormat ConvertBlipTypeToImageFormat(MsoBlipType blipType) { return(ImageFormat.Png); }