Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public BitmapShape Add(Image image, MsoBlipType blipType)
 {
     return(this.Add(image, blipType, false));
 }
Exemplo n.º 5
0
 internal void Add(Image image, Rectangle rect, MsoBlipType blipType)
 {
     this.AddImage(image, rect);
     this.Worksheet.Shapes.Add(image, rect, blipType);
 }
Exemplo n.º 6
0
 internal void Add(Image image, MsoBlipType blipType)
 {
     this.AddImage(image);
     this.Worksheet.Shapes.Add(image, blipType);
 }
Exemplo n.º 7
0
 public static ImageFormat ConvertBlipTypeToImageFormat(MsoBlipType blipType)
 {
     return(ImageFormat.Png);
 }