You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Théo <tm...@gmail.com> on 2008/06/10 15:34:57 UTC

HSSF - Adding Picture is 133% of actual size

Hi !
I have a problem with poi-3.0.2-FINAL : Each time I add a picture to an
excel sheet,  it always scales to 133% of real size.

I have just download and tested with poi-3.1-beta2. I have almost the same
problem except the ratio is 118% for height and 125% for width. I really
don't understand what's wrong...
This is the code : (I tried with picture.resize() and
picture.getPrefferedSize() methods)

  public static void main(String[] args) throws IOException {
>     FileOutputStream locFileOut = null;
>     try {
>
>       HSSFSheet locSheet = locWorkBook.getSheetAt(0);
>
>       HSSFPatriarch patriarch = locSheet.createDrawingPatriarch();
>       HSSFPicture picture = patriarch.createPicture(new HSSFClientAnchor(),
> loadPicture(locWorkBook,
> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>       picture.resize();
>
>       // HSSFPicture picture = patriarch.createPicture(new
> HSSFClientAnchor(), loadPicture(locWorkBook,
> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>       // HSSFClientAnchor preferredSize = picture.getPreferredSize();
>       // picture.setAnchor(preferredSize);
>
>       locFileOut = new FileOutputStream("C:\\Documents and
> Settings\\Dev3\\Bureau\\test_excel_result.xls");
>       locWorkBook.write(locFileOut);
>       Desktop.getDesktop().open(new File("C:\\Documents and
> Settings\\Dev3\\Bureau\\test_excel_result.xls"));
>     } finally {
>       if (locFileOut != null) {
>         SystemUtilities.closeCloseable_IFP(locFileOut);
>       }
>     }
>   }
>

My problem looks like this one :http://java2.5341.com/msg/208849.html
The difference if that I have this problem for excel export.

Should I open a bug for this problem?
thank you very much in advance for your help.

Re: HSSF - Adding Picture is 133% of actual size

Posted by Théo <tm...@gmail.com>.
Ok It seems to be a problem with the columns width and rows height. The
ratio changes if I change theses values. Is there a way to resize the
picture to the real size without touching the rows height and columns width
?
Thank you very much.

2008/6/11 Théo <tm...@gmail.com>:

> I am using 96dpi on my display. I really don't understand what is wrong. I
> am going to try on another computer.
>
> 2008/6/10 Yegor Kozlov <ye...@dinom.ru>:
>
> What is the DPI setting of your display? HSSFPicture.resize() works good on
>> 96 dpi only.
>>
>> Yegor
>>
>>
>>  Hi !
>>> I have a problem with poi-3.0.2-FINAL : Each time I add a picture to an
>>> excel sheet,  it always scales to 133% of real size.
>>>
>>> I have just download and tested with poi-3.1-beta2. I have almost the
>>> same
>>> problem except the ratio is 118% for height and 125% for width. I really
>>> don't understand what's wrong...
>>> This is the code : (I tried with picture.resize() and
>>> picture.getPrefferedSize() methods)
>>>
>>>  public static void main(String[] args) throws IOException {
>>>
>>>>    FileOutputStream locFileOut = null;
>>>>    try {
>>>>
>>>>      HSSFSheet locSheet = locWorkBook.getSheetAt(0);
>>>>
>>>>      HSSFPatriarch patriarch = locSheet.createDrawingPatriarch();
>>>>      HSSFPicture picture = patriarch.createPicture(new
>>>> HSSFClientAnchor(),
>>>> loadPicture(locWorkBook,
>>>> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>>>>      picture.resize();
>>>>
>>>>      // HSSFPicture picture = patriarch.createPicture(new
>>>> HSSFClientAnchor(), loadPicture(locWorkBook,
>>>> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>>>>      // HSSFClientAnchor preferredSize = picture.getPreferredSize();
>>>>      // picture.setAnchor(preferredSize);
>>>>
>>>>      locFileOut = new FileOutputStream("C:\\Documents and
>>>> Settings\\Dev3\\Bureau\\test_excel_result.xls");
>>>>      locWorkBook.write(locFileOut);
>>>>      Desktop.getDesktop().open(new File("C:\\Documents and
>>>> Settings\\Dev3\\Bureau\\test_excel_result.xls"));
>>>>    } finally {
>>>>      if (locFileOut != null) {
>>>>        SystemUtilities.closeCloseable_IFP(locFileOut);
>>>>      }
>>>>    }
>>>>  }
>>>>
>>>>
>>> My problem looks like this one :http://java2.5341.com/msg/208849.html
>>> The difference if that I have this problem for excel export.
>>>
>>> Should I open a bug for this problem?
>>> thank you very much in advance for your help.
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>

Re: HSSF - Adding Picture is 133% of actual size

Posted by Théo <tm...@gmail.com>.
I am using 96dpi on my display. I really don't understand what is wrong. I
am going to try on another computer.

2008/6/10 Yegor Kozlov <ye...@dinom.ru>:

> What is the DPI setting of your display? HSSFPicture.resize() works good on
> 96 dpi only.
>
> Yegor
>
>
>  Hi !
>> I have a problem with poi-3.0.2-FINAL : Each time I add a picture to an
>> excel sheet,  it always scales to 133% of real size.
>>
>> I have just download and tested with poi-3.1-beta2. I have almost the same
>> problem except the ratio is 118% for height and 125% for width. I really
>> don't understand what's wrong...
>> This is the code : (I tried with picture.resize() and
>> picture.getPrefferedSize() methods)
>>
>>  public static void main(String[] args) throws IOException {
>>
>>>    FileOutputStream locFileOut = null;
>>>    try {
>>>
>>>      HSSFSheet locSheet = locWorkBook.getSheetAt(0);
>>>
>>>      HSSFPatriarch patriarch = locSheet.createDrawingPatriarch();
>>>      HSSFPicture picture = patriarch.createPicture(new
>>> HSSFClientAnchor(),
>>> loadPicture(locWorkBook,
>>> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>>>      picture.resize();
>>>
>>>      // HSSFPicture picture = patriarch.createPicture(new
>>> HSSFClientAnchor(), loadPicture(locWorkBook,
>>> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>>>      // HSSFClientAnchor preferredSize = picture.getPreferredSize();
>>>      // picture.setAnchor(preferredSize);
>>>
>>>      locFileOut = new FileOutputStream("C:\\Documents and
>>> Settings\\Dev3\\Bureau\\test_excel_result.xls");
>>>      locWorkBook.write(locFileOut);
>>>      Desktop.getDesktop().open(new File("C:\\Documents and
>>> Settings\\Dev3\\Bureau\\test_excel_result.xls"));
>>>    } finally {
>>>      if (locFileOut != null) {
>>>        SystemUtilities.closeCloseable_IFP(locFileOut);
>>>      }
>>>    }
>>>  }
>>>
>>>
>> My problem looks like this one :http://java2.5341.com/msg/208849.html
>> The difference if that I have this problem for excel export.
>>
>> Should I open a bug for this problem?
>> thank you very much in advance for your help.
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: HSSF - Adding Picture is 133% of actual size

Posted by Yegor Kozlov <ye...@dinom.ru>.
What is the DPI setting of your display? HSSFPicture.resize() works good on 96 dpi only.

Yegor

> Hi !
> I have a problem with poi-3.0.2-FINAL : Each time I add a picture to an
> excel sheet,  it always scales to 133% of real size.
> 
> I have just download and tested with poi-3.1-beta2. I have almost the same
> problem except the ratio is 118% for height and 125% for width. I really
> don't understand what's wrong...
> This is the code : (I tried with picture.resize() and
> picture.getPrefferedSize() methods)
> 
>   public static void main(String[] args) throws IOException {
>>     FileOutputStream locFileOut = null;
>>     try {
>>
>>       HSSFSheet locSheet = locWorkBook.getSheetAt(0);
>>
>>       HSSFPatriarch patriarch = locSheet.createDrawingPatriarch();
>>       HSSFPicture picture = patriarch.createPicture(new HSSFClientAnchor(),
>> loadPicture(locWorkBook,
>> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>>       picture.resize();
>>
>>       // HSSFPicture picture = patriarch.createPicture(new
>> HSSFClientAnchor(), loadPicture(locWorkBook,
>> "C:\\JUMP\\jams\\output_reports\\test-_excel_image\\a.png"));
>>       // HSSFClientAnchor preferredSize = picture.getPreferredSize();
>>       // picture.setAnchor(preferredSize);
>>
>>       locFileOut = new FileOutputStream("C:\\Documents and
>> Settings\\Dev3\\Bureau\\test_excel_result.xls");
>>       locWorkBook.write(locFileOut);
>>       Desktop.getDesktop().open(new File("C:\\Documents and
>> Settings\\Dev3\\Bureau\\test_excel_result.xls"));
>>     } finally {
>>       if (locFileOut != null) {
>>         SystemUtilities.closeCloseable_IFP(locFileOut);
>>       }
>>     }
>>   }
>>
> 
> My problem looks like this one :http://java2.5341.com/msg/208849.html
> The difference if that I have this problem for excel export.
> 
> Should I open a bug for this problem?
> thank you very much in advance for your help.
> 


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