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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to