mirror of https://github.com/apache/poi.git
HSSF docs updated: added a note on using HSSFSheet.autoSizeColumn in headless mode and added a note on how to read images from a workbook
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@535623 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c147b22f61
commit
5c789d18d3
|
@ -975,8 +975,7 @@
|
||||||
<li>DIB</li>
|
<li>DIB</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
It is not currently possible to read existing images and it
|
It should be noted that any existing drawings may be erased
|
||||||
should be noted that any existing drawings may be erased
|
|
||||||
once you add a image to a sheet.
|
once you add a image to a sheet.
|
||||||
</p>
|
</p>
|
||||||
<source>
|
<source>
|
||||||
|
@ -988,7 +987,23 @@
|
||||||
anchor = new HSSFClientAnchor(0,0,0,255,(short)2,2,(short)4,7);
|
anchor = new HSSFClientAnchor(0,0,0,255,(short)2,2,(short)4,7);
|
||||||
anchor.setAnchorType( 2 );
|
anchor.setAnchorType( 2 );
|
||||||
patriarch.createPicture(anchor, loadPicture( "src/resources/logos/logoKarmokar4.png", wb ));
|
patriarch.createPicture(anchor, loadPicture( "src/resources/logos/logoKarmokar4.png", wb ));
|
||||||
</source>
|
</source>
|
||||||
|
<p>Reading images from a workbook:</p>
|
||||||
|
<source>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</source>
|
||||||
</section>
|
</section>
|
||||||
<anchor id="NamedRanges"/>
|
<anchor id="NamedRanges"/>
|
||||||
<section>
|
<section>
|
||||||
|
@ -1141,7 +1156,13 @@
|
||||||
sheet.autoSizeColumn((short)0); //adjust width of the first column
|
sheet.autoSizeColumn((short)0); //adjust width of the first column
|
||||||
sheet.autoSizeColumn((short)1); //adjust width of the second column
|
sheet.autoSizeColumn((short)1); //adjust width of the second column
|
||||||
</source>
|
</source>
|
||||||
|
<warning>
|
||||||
|
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: <code> java.awt.headless=true </code>
|
||||||
|
(either via <code>-Djava.awt.headless=true</code> startup parameter or via <code>System.setProperty("java.awt.headless", "true")</code>).
|
||||||
|
</warning>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue