How to set image size in footer of excel

Last post 02-10-2012, 9:38 AM by mshakeel.faiz. 4 replies.
Sort Posts: Previous Next
  •  02-09-2012, 3:17 PM 360518

    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.

     

     
  •  02-10-2012, 2:58 AM 360581 in reply to 360518

    Re: How to set image size in footer of excel

    Hi,

    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.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  02-10-2012, 3:26 AM 360601 in reply to 360581

    Re: How to set image size in footer of excel

    Hi,

    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()];
    inFile.read(picData);
    pageSetup.setFooterPicture(1,picData);

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


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

    //Saving the workbook
    workbook.save("d:\\headerpic.xls");

    //Closing the FileStream object    
    inFile.close();

    Thank you.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  02-10-2012, 9:16 AM 360749 in reply to 360601

    Re: How to set image size in footer of excel

    Thanks for the code.

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

     

    Thank you.

     
  •  02-10-2012, 9:38 AM 360757 in reply to 360749

    Re: How to set image size in footer of excel

    Hi,

    It's in pixels.

    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Sialkot Team
    Contact Us
    Aspose - The .NET and Java Component Publisher

    Keep in touch! We're on Twitter and Facebook
     
View as RSS news feed in XML