Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6022177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:49:16+00:00 2026-05-23T03:49:16+00:00

I am adding an image to the worksheet through some code like this: //

  • 0

I am adding an image to the worksheet through some code like this:

// Create the drawing patriarch.  This is the top level container for all shapes.
Drawing drawing = sheet.createDrawingPatriarch();

//add a picture shape
//ClientAnchor anchor = this.creationHelper.createClientAnchor();
ClientAnchor anchor = new HSSFClientAnchor((short)0, (short)0, (short)0, (short)0, (short)0, (short)0, (short)2, (short)5)

// 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells. 
anchor.setAnchorType(2)

HSSFPicture pict = drawing.createPicture(anchor, this.images.get("logo"));
pict.resize() ;

However just after the images are added, I resize the columns – which seems to mess things up. It resizes the images – which is not what I want.

//psuedo code
public void autoSizeColumns() {
    def cols = (StartColumn..this.cMax)
    cols.each { i ->
        sheet.autoSizeColumn i
    }   
}

BrandedWorksheet v; 
v.autoSizeColumns()

If I don’t perform the autoSizeColumns() the image is the proper size.

Is there any way to have both?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:49:17+00:00Added an answer on May 23, 2026 at 3:49 am

    This is crazy and doesn’t make much sense, but allocating the proper amount of spacing and rows seems to be the key. I added enough rows so that the image could be bound internally to the rows – and all seems good.

    Moral of the story: keep working and messing about and it may eventually work. You will get really frustrated, and there won’t be a ton of help out there – because those of us who have properly sized an image don’t really understand why.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIButton, and I'm adding an image to it using this code:
Here is my code. This is adding image but images are being appeared in
I would like to show some text with an image. But I would like
I was testing adding a static image in an reused cell vs drawing it
I have following code for an autocomplete box, I'm adding an image for choice
I have problem with adding image to DGV cell after data binding. this is
I am dynamically adding an image to a canvas object which was working for
I'm adding an Image View in Interface Builder with a transparent PNG (A logo
I am facing a problem in adding an image at the end of the
i am having a problem in adding the image files to project namespace. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.