Free Support Forum -

Footer image not alligned according to margins


When Footer image is added to the excel document it doesn’t scales/alligns according to margins. For more information please see the attached image file. One more thing that i noticed is that the image also gets blur.
I use the following code to add the image in the footer.

Image fImg = Image.FromFile(sFileName);
Bitmap b = new Bitmap(width_pt, height_pt);
using (Graphics g = Graphics.FromImage((Image)b))
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawImage(fImg, 0, 0, width_pt, height_pt);
MemoryStream stream = new MemoryStream();
b.Save(stream, ImageFormat.Bmp);
byte[] bmpBytes = stream.GetBuffer();
this._oAsposeWorksheet.PageSetup.SetFooter(1, “&G”);
this._oAsposeWorksheet.PageSetup.SetFooterPicture(1, bmpBytes);

Any help in this regard would be appreciated

PS: If you have any plans of suggesting me to use the latest version then drop it. I already have tested it with no result :smiley:



Well, to format / scale or set the size of the header/footer picture, you may try some API,


//Get the picture object for the header picture
Aspose.Cells.Picture pic = pageSetup.SetFooterPicture(1, imageData);

//Now use/set pic object’s attribute and methods to scale or size the picture for your need.

//OR use:
//Aspose.Cells.Picture pic = pageSetup.GetPicture(false,1);

//Setting the script for the logo/picture

pageSetup.SetFooter(1, “&G”);

For blur issue, could you post a sample application, we will check it soon.

Thank you.