We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set image size in footer of excel

I need to set the size of the image in the footer using aspose cells. can you please let me know how to do it. Basically this is what i need to do using aspose. The below workflow can be done using ms excel.

  1. Click the View tab.
  2. Click in the header or footer section where the image is located.
  3. Click in the &[Picture] text of the image.
  4. On the Design tab under Header & Footer Tools, click Format Picture in the Header & Footer Elements group.
  5. On the Size tab, adjust the size of the image to fit inside the header or footer section.
  6. Click OK.

Thank you.


I am afraid the feature is not supported. I have logged a ticket with a ticket with an id: CELLSJAVA-40133. We will look into it soon.

Thank you.

It is already supported in the latest version of Aspose.Cells for JAVA v7.1.0, please try it. Here is the sample code for your reference.

Sample code:

//Creating a Workbook object
Workbook workbook = new Workbook();

//Creating a string variable to store the url of the logo/picture
String logo_url = "d:\\school.jpg";

//Creating the instance of the FileInputStream object to open the logo/picture in the stream
FileInputStream inFile = new FileInputStream(logo_url);

//Creating a PageSetup object to get the page settings of the first worksheet of the workbook
PageSetup pageSetup = workbook.getWorksheets().get(0).getPageSetup();

//Setting the logo/picture in the central section of the page footer
pageSetup.setFooter(1, "&G");
byte[] picData = new byte[inFile.available()];

Picture pic = workbook.getWorksheets().get(0).getPageSetup().getPicture(false, 1);

//Setting the Sheet's name in the right section of the page header with the script
pageSetup.setHeader(2, "&A");

//Saving the workbook

//Closing the FileStream object

Thank you.

Thanks for the code.

It is working. another question, the height you specified is it in pixels or which unit?

Thank you.


It’s in pixels.