diff --git a/src/documentation/content/xdocs/hssf/quick-guide.xml b/src/documentation/content/xdocs/hssf/quick-guide.xml index 0d174b5bb..224b458c7 100644 --- a/src/documentation/content/xdocs/hssf/quick-guide.xml +++ b/src/documentation/content/xdocs/hssf/quick-guide.xml @@ -975,8 +975,7 @@
  • DIB
  • - It is not currently possible to read existing images and it - should be noted that any existing drawings may be erased + It should be noted that any existing drawings may be erased once you add a image to a sheet.

    @@ -988,7 +987,23 @@ anchor = new HSSFClientAnchor(0,0,0,255,(short)2,2,(short)4,7); anchor.setAnchorType( 2 ); patriarch.createPicture(anchor, loadPicture( "src/resources/logos/logoKarmokar4.png", wb )); - + +

    Reading images from a workbook:

    + + HSSFWorkbook wb; + + List lst = wb.getAllPictures(); + for (Iterator it = lst.iterator(); it.hasNext(); ) { + HSSFPictureData pict = (HSSFPictureData)it.next(); + String ext = pict.suggestFileExtension(); + byte[] data = pict.getData(); + if (ext.equals("jpeg")){ + FileOutputStream out = new FileOutputStream("pict.jpg"); + out.write(data); + out.close(); + } + } +
    @@ -1141,7 +1156,13 @@ sheet.autoSizeColumn((short)0); //adjust width of the first column sheet.autoSizeColumn((short)1); //adjust width of the second column - + + To calculate column width HSSFSheet.autoSizeColumn uses Java2D classes + that throw exception if graphical environment is not available. In case if graphical environment + is not available, you must tell Java that you are running in headless mode and + set the following system property: java.awt.headless=true + (either via -Djava.awt.headless=true startup parameter or via System.setProperty("java.awt.headless", "true")). +