You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by fr...@bell.ca on 2009/03/06 16:05:07 UTC

Image resized when inserted in Excel through createPicture

Hi,

I'm trying to insert an image through HSSFPatriarch's createPicture method, but when opening the generated file in Excel the image is resized. I've set the resolution of the image to 96 dpi to match what Excel uses, and although the height seems OK the width is set to somewhere between 80 and 90%.

I've tried using HSSFPicture's resize method with a scale parameter, but for some reason I keep getting an error.

Anyone seen this before?

Thanks,

Francois

RE: Image resized when inserted in Excel through createPicture

Posted by fr...@bell.ca.
Hi Yegor,

I was using a template workbook. Thanks to your advice I created a new one through POI, inserted the image and it worked great!

Thanks again,

François Lévesque | Programmeur - Applications Web | Programmer - Web Applications 

Web Développement & Support | Web Development & Support



-----Original Message-----
From: Yegor Kozlov [mailto:yegor@dinom.ru] 
Sent: March 11, 2009 7:38 AM
To: POI Users List
Subject: Re: Image resized when inserted in Excel through createPicture

Are you using a template workbook or create one from scratch using POI?
HSSFPicture.resize() uses some hardcoded constants that were obtained empirically for the default font (Arial 10pt) at 
96 dpi. If any of these settings are custom, the result can be "off".

If you think it is a bug, create an issue in bugzilla and attach the image and sample code to reproduce the problem (and 
the bad file too).

Yegor

> Hi,
> 
> Bump. Anyone have any idea for this?
> 
> Thanks,
> 
> Francois
> 
> 
> -----Original Message-----
> Sent: March 6, 2009 10:05 AM
> To: user@poi.apache.org
> Subject: Image resized when inserted in Excel through createPicture
> 
> Hi,
> 
> I'm trying to insert an image through HSSFPatriarch's createPicture method, but when opening the generated file in Excel the image is resized. I've set the resolution of the image to 96 dpi to match what Excel uses, and although the height seems OK the width is set to somewhere between 80 and 90%.
> 
> I've tried using HSSFPicture's resize method with a scale parameter, but for some reason I keep getting an error.
> 
> Anyone seen this before?
> 
> Thanks,
> 
> Francois
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Image resized when inserted in Excel through createPicture

Posted by Yegor Kozlov <ye...@dinom.ru>.
Are you using a template workbook or create one from scratch using POI?
HSSFPicture.resize() uses some hardcoded constants that were obtained empirically for the default font (Arial 10pt) at 
96 dpi. If any of these settings are custom, the result can be "off".

If you think it is a bug, create an issue in bugzilla and attach the image and sample code to reproduce the problem (and 
the bad file too).

Yegor

> Hi,
> 
> Bump. Anyone have any idea for this?
> 
> Thanks,
> 
> Francois
> 
> 
> -----Original Message-----
> Sent: March 6, 2009 10:05 AM
> To: user@poi.apache.org
> Subject: Image resized when inserted in Excel through createPicture
> 
> Hi,
> 
> I'm trying to insert an image through HSSFPatriarch's createPicture method, but when opening the generated file in Excel the image is resized. I've set the resolution of the image to 96 dpi to match what Excel uses, and although the height seems OK the width is set to somewhere between 80 and 90%.
> 
> I've tried using HSSFPicture's resize method with a scale parameter, but for some reason I keep getting an error.
> 
> Anyone seen this before?
> 
> Thanks,
> 
> Francois
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Image resized when inserted in Excel through createPicture

Posted by fr...@bell.ca.
Hi,

Bump. Anyone have any idea for this?

Thanks,

Francois


-----Original Message-----
Sent: March 6, 2009 10:05 AM
To: user@poi.apache.org
Subject: Image resized when inserted in Excel through createPicture

Hi,

I'm trying to insert an image through HSSFPatriarch's createPicture method, but when opening the generated file in Excel the image is resized. I've set the resolution of the image to 96 dpi to match what Excel uses, and although the height seems OK the width is set to somewhere between 80 and 90%.

I've tried using HSSFPicture's resize method with a scale parameter, but for some reason I keep getting an error.

Anyone seen this before?

Thanks,

Francois

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org