Java Doc for HSSFWorkbook.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hssf » usermodel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hssf.usermodel 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.poi.POIDocument
      org.apache.poi.hssf.usermodel.HSSFWorkbook

HSSFWorkbook
public class HSSFWorkbook extends POIDocument (Code)
High level representation of a workbook. This is the first object most users will construct whether they are reading or writing a workbook. It is also the top level object for creating new sheets/etc.
See Also:   org.apache.poi.hssf.model.Workbook
See Also:   org.apache.poi.hssf.usermodel.HSSFSheet
author:
   Andrew C. Oliver (acoliver at apache dot org)
author:
   Glen Stampoultzis (glens at apache.org)
author:
   Shawn Laubach (slaubach at apache dot org)
version:
   2.0-pre


Field Summary
final public static  byteENCODING_COMPRESSED_UNICODE
    
final public static  byteENCODING_UTF_16
    
final public static  intINITIAL_CAPACITY
     used for compile-time performance/memory optimization.
final public static  intPICTURE_TYPE_DIB
    
final public static  intPICTURE_TYPE_EMF
    
final public static  intPICTURE_TYPE_JPEG
    
final public static  intPICTURE_TYPE_PICT
    
final public static  intPICTURE_TYPE_PNG
    
final public static  intPICTURE_TYPE_WMF
    
protected  ArrayListsheets
    

Constructor Summary
public  HSSFWorkbook()
    
protected  HSSFWorkbook(Workbook book)
    
public  HSSFWorkbook(POIFSFileSystem fs)
    
public  HSSFWorkbook(POIFSFileSystem fs, boolean preserveNodes)
     given a POI POIFSFileSystem object, read in its Workbook and populate the high and low level models.
public  HSSFWorkbook(InputStream s)
    
public  HSSFWorkbook(InputStream s, boolean preserveNodes)
     Companion to HSSFWorkbook(POIFSFileSystem), this constructs the POI filesystem around your inputstream.
Parameters:
  s - the POI filesystem that contains the Workbook stream.
Parameters:
  preserveNodes - whether to preseve other nodes, such asmacros.

Method Summary
public  intaddPicture(byte[] pictureData, int format)
     Adds a picture to the workbook.
Parameters:
  pictureData - The bytes of the picture
Parameters:
  format - The format of the picture.
public  intaddSSTString(String string)
    
public  HSSFSheetcloneSheet(int sheetNum)
     create an HSSFSheet from an existing sheet in the HSSFWorkbook.
public  HSSFCellStylecreateCellStyle()
    
public  HSSFDataFormatcreateDataFormat()
     Returns the instance of HSSFDataFormat for this workbook.
public  HSSFFontcreateFont()
    
public  HSSFNamecreateName()
    
public  HSSFSheetcreateSheet()
     create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation.
public  HSSFSheetcreateSheet(String sheetname)
     create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation.
public  voiddumpDrawingGroupRecords(boolean fat)
     Spits out a list of all the drawing records in the workbook.
public  HSSFFontfindFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
    
public  ListgetAllEmbeddedObjects()
     Gets all embedded OLE2 objects from the Workbook.
public  ListgetAllPictures()
     Gets all pictures from the Workbook.
public  booleangetBackupFlag()
     determine whether the Excel GUI will backup the workbook when saving.
public  byte[]getBytes()
     Method getBytes - get the bytes of just the HSSF portions of the XLS file.
public  HSSFCellStylegetCellStyleAt(short idx)
    
public  HSSFPalettegetCustomPalette()
    
public  shortgetDisplayedTab()
     sets the first tab that is displayed in the list of tabs in excel.
public  HSSFFontgetFontAt(short idx)
    
public  HSSFNamegetNameAt(int index)
    
public  intgetNameIndex(String name)
     gets the named range index by his name Note:Excel named ranges are case-insensitive and this method performs a case-insensitive search.
public  StringgetNameName(int index)
    
public  shortgetNumCellStyles()
    
public  shortgetNumberOfFonts()
    
public  intgetNumberOfNames()
    
public  intgetNumberOfSheets()
    
public  StringgetPrintArea(int sheetIndex)
     Retrieves the reference for the printarea of the specified sheet, the sheet name is appended to the reference even if it was not specified.
public  StringgetSSTString(int index)
    
public  shortgetSelectedTab()
     gets the tab whose data is actually seen when the sheet is opened.
public  HSSFSheetgetSheet(String name)
    
public  HSSFSheetgetSheetAt(int index)
     Get the HSSFSheet object at the given index.
public  intgetSheetIndex(String name)
    
public  intgetSheetIndex(HSSFSheet sheet)
    
public  StringgetSheetName(int sheet)
    
protected  WorkbookgetWorkbook()
    
public  voidinsertChartRecord()
     Test only.
public  voidremoveName(int index)
    
public  voidremoveName(String name)
    
public  voidremovePrintArea(int sheetIndex)
    
public  voidremoveSheetAt(int index)
    
public  voidsetBackupFlag(boolean backupValue)
     determine whether the Excel GUI will backup the workbook when saving.
public  voidsetDisplayedTab(short index)
     sets the first tab that is displayed in the list of tabs in excel.
public  voidsetPrintArea(int sheetIndex, String reference)
     Sets the printarea for the sheet provided

i.e.

public  voidsetPrintArea(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow)
     For the Convenience of Java Programmers maintaining pointers.
public  voidsetRepeatingRowsAndColumns(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow)
     Sets the repeating rows and columns for a sheet (as found in File->PageSetup->Sheet).
public  voidsetSelectedTab(short index)
     sets the tab whose data is actually seen when the sheet is opened.
public  voidsetSheetName(int sheet, String name)
     set the sheet name.
public  voidsetSheetName(int sheet, String name, short encoding)
     set the sheet name forcing the encoding.
public  voidsetSheetOrder(String sheetname, int pos)
     sets the order of appearance for a given sheet.
public  voidunwriteProtectWorkbook()
    
public  voidwrite(OutputStream stream)
     Method write - write out this workbook to an Outputstream.
public  voidwriteProtectWorkbook(String password, String username)
     protect a workbook with a password (not encypted, just sets writeprotect flags and the password.

Field Detail
ENCODING_COMPRESSED_UNICODE
final public static byte ENCODING_COMPRESSED_UNICODE(Code)



ENCODING_UTF_16
final public static byte ENCODING_UTF_16(Code)



INITIAL_CAPACITY
final public static int INITIAL_CAPACITY(Code)
used for compile-time performance/memory optimization. This determines the initial capacity for the sheet collection. Its currently set to 3. Changing it in this release will decrease performance since you're never allowed to have more or less than three sheets!



PICTURE_TYPE_DIB
final public static int PICTURE_TYPE_DIB(Code)
Device independant bitmap



PICTURE_TYPE_EMF
final public static int PICTURE_TYPE_EMF(Code)
Extended windows meta file



PICTURE_TYPE_JPEG
final public static int PICTURE_TYPE_JPEG(Code)
JPEG format



PICTURE_TYPE_PICT
final public static int PICTURE_TYPE_PICT(Code)
Mac PICT format



PICTURE_TYPE_PNG
final public static int PICTURE_TYPE_PNG(Code)
PNG format



PICTURE_TYPE_WMF
final public static int PICTURE_TYPE_WMF(Code)
Windows Meta File



sheets
protected ArrayList sheets(Code)
this holds the HSSFSheet objects attached to this workbook




Constructor Detail
HSSFWorkbook
public HSSFWorkbook()(Code)
Creates new HSSFWorkbook from scratch (start here!)



HSSFWorkbook
protected HSSFWorkbook(Workbook book)(Code)



HSSFWorkbook
public HSSFWorkbook(POIFSFileSystem fs) throws IOException(Code)



HSSFWorkbook
public HSSFWorkbook(POIFSFileSystem fs, boolean preserveNodes) throws IOException(Code)
given a POI POIFSFileSystem object, read in its Workbook and populate the high and low level models. If you're reading in a workbook...start here.
Parameters:
  fs - the POI filesystem that contains the Workbook stream.
Parameters:
  preserveNodes - whether to preseve other nodes, such asmacros. This takes more memory, so only say yes if youneed to. If set, will store all of the POIFSFileSystemin memory
See Also:   org.apache.poi.poifs.filesystem.POIFSFileSystem
exception:
  IOException - if the stream cannot be read



HSSFWorkbook
public HSSFWorkbook(InputStream s) throws IOException(Code)



HSSFWorkbook
public HSSFWorkbook(InputStream s, boolean preserveNodes) throws IOException(Code)
Companion to HSSFWorkbook(POIFSFileSystem), this constructs the POI filesystem around your inputstream.
Parameters:
  s - the POI filesystem that contains the Workbook stream.
Parameters:
  preserveNodes - whether to preseve other nodes, such asmacros. This takes more memory, so only say yes if youneed to.
See Also:   org.apache.poi.poifs.filesystem.POIFSFileSystem
See Also:   HSSFWorkbook.HSSFWorkbook(POIFSFileSystem)
exception:
  IOException - if the stream cannot be read




Method Detail
addPicture
public int addPicture(byte[] pictureData, int format)(Code)
Adds a picture to the workbook.
Parameters:
  pictureData - The bytes of the picture
Parameters:
  format - The format of the picture. One of PICTURE_TYPE_* the index to this picture (1 based).



addSSTString
public int addSSTString(String string)(Code)



cloneSheet
public HSSFSheet cloneSheet(int sheetNum)(Code)
create an HSSFSheet from an existing sheet in the HSSFWorkbook. HSSFSheet representing the cloned sheet.



createCellStyle
public HSSFCellStyle createCellStyle()(Code)
create a new Cell style and add it to the workbook's style table the new Cell Style object



createDataFormat
public HSSFDataFormat createDataFormat()(Code)
Returns the instance of HSSFDataFormat for this workbook. the HSSFDataFormat object
See Also:   org.apache.poi.hssf.record.FormatRecord
See Also:   org.apache.poi.hssf.record.Record



createFont
public HSSFFont createFont()(Code)
create a new Font and add it to the workbook's font table new font object



createName
public HSSFName createName()(Code)
creates a new named range and add it to the model named range high level



createSheet
public HSSFSheet createSheet()(Code)
create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation. Use this to create new sheets. HSSFSheet representing the new sheet.



createSheet
public HSSFSheet createSheet(String sheetname)(Code)
create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation. Use this to create new sheets.
Parameters:
  sheetname - sheetname to set for the sheet. HSSFSheet representing the new sheet.



dumpDrawingGroupRecords
public void dumpDrawingGroupRecords(boolean fat)(Code)
Spits out a list of all the drawing records in the workbook.



findFont
public HSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)(Code)
Finds a font that matches the one with the supplied attributes



getAllEmbeddedObjects
public List getAllEmbeddedObjects()(Code)
Gets all embedded OLE2 objects from the Workbook. the list of embedded objects (a list of HSSFObjectData objects.)



getAllPictures
public List getAllPictures()(Code)
Gets all pictures from the Workbook. the list of pictures (a list of HSSFPictureData objects.)



getBackupFlag
public boolean getBackupFlag()(Code)
determine whether the Excel GUI will backup the workbook when saving. the current setting for backups.



getBytes
public byte[] getBytes()(Code)
Method getBytes - get the bytes of just the HSSF portions of the XLS file. Use this to construct a POI POIFSFileSystem yourself. byte[] array containing the binary representation of this workbook and all containedsheets, rows, cells, etc.
See Also:   org.apache.poi.hssf.model.Workbook
See Also:   org.apache.poi.hssf.model.Sheet



getCellStyleAt
public HSSFCellStyle getCellStyleAt(short idx)(Code)
get the cell style object at the given index
Parameters:
  idx - index within the set of styles HSSFCellStyle object at the index



getCustomPalette
public HSSFPalette getCustomPalette()(Code)



getDisplayedTab
public short getDisplayedTab()(Code)
sets the first tab that is displayed in the list of tabs in excel.



getFontAt
public HSSFFont getFontAt(short idx)(Code)
get the font at the given index number
Parameters:
  idx - index number HSSFFont at the index



getNameAt
public HSSFName getNameAt(int index)(Code)
gets the Named range
Parameters:
  index - position of the named range named range high level



getNameIndex
public int getNameIndex(String name)(Code)
gets the named range index by his name Note:Excel named ranges are case-insensitive and this method performs a case-insensitive search.
Parameters:
  name - named range name named range index



getNameName
public String getNameName(int index)(Code)
gets the named range name
Parameters:
  index - the named range index (0 based) named range name



getNumCellStyles
public short getNumCellStyles()(Code)
get the number of styles the workbook contains count of cell styles



getNumberOfFonts
public short getNumberOfFonts()(Code)
get the number of fonts in the font table number of fonts



getNumberOfNames
public int getNumberOfNames()(Code)
gets the total number of named ranges in the workboko number of named ranges



getNumberOfSheets
public int getNumberOfSheets()(Code)
get the number of spreadsheets in the workbook (this will be three after serialization) number of sheets



getPrintArea
public String getPrintArea(int sheetIndex)(Code)
Retrieves the reference for the printarea of the specified sheet, the sheet name is appended to the reference even if it was not specified.
Parameters:
  sheetIndex - Zero-based sheet index (0 Represents the first sheet to keep consistent with java) String Null if no print area has been defined



getSSTString
public String getSSTString(int index)(Code)



getSelectedTab
public short getSelectedTab()(Code)
gets the tab whose data is actually seen when the sheet is opened. This may be different from the "selected sheet" since excel seems to allow you to show the data of one sheet when another is seen "selected" in the tabs (at the bottom).
See Also:   org.apache.poi.hssf.usermodel.HSSFSheet.setSelected(boolean)



getSheet
public HSSFSheet getSheet(String name)(Code)
Get sheet with the given name
Parameters:
  name - of the sheet HSSFSheet with the name provided or null if it does not exist



getSheetAt
public HSSFSheet getSheetAt(int index)(Code)
Get the HSSFSheet object at the given index.
Parameters:
  index - of the sheet number (0-based physical & logical) HSSFSheet at the provided index



getSheetIndex
public int getSheetIndex(String name)(Code)
Returns the index of the sheet by his name
Parameters:
  name - the sheet name index of the sheet (0 based)



getSheetIndex
public int getSheetIndex(HSSFSheet sheet)(Code)
Returns the index of the given sheet
Parameters:
  sheet - the sheet to look up index of the sheet (0 based)



getSheetName
public String getSheetName(int sheet)(Code)
get the sheet name
Parameters:
  sheet - Number Sheet name



getWorkbook
protected Workbook getWorkbook()(Code)



insertChartRecord
public void insertChartRecord()(Code)
Test only. Do not use



removeName
public void removeName(int index)(Code)
remove the named range by his index
Parameters:
  index - named range index (0 based)



removeName
public void removeName(String name)(Code)
remove the named range by his name
Parameters:
  name - named range name



removePrintArea
public void removePrintArea(int sheetIndex)(Code)
Delete the printarea for the sheet specified
Parameters:
  sheetIndex - Zero-based sheet index (0 = First Sheet)



removeSheetAt
public void removeSheetAt(int index)(Code)
removes sheet at the given index
Parameters:
  index - of the sheet (0-based)



setBackupFlag
public void setBackupFlag(boolean backupValue)(Code)
determine whether the Excel GUI will backup the workbook when saving.
Parameters:
  backupValue - true to indicate a backup will be performed.



setDisplayedTab
public void setDisplayedTab(short index)(Code)
sets the first tab that is displayed in the list of tabs in excel.
Parameters:
  index -



setPrintArea
public void setPrintArea(int sheetIndex, String reference)(Code)
Sets the printarea for the sheet provided

i.e. Reference = $A$1:$B$2
Parameters:
  sheetIndex - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
Parameters:
  reference - Valid name Reference for the Print Area




setPrintArea
public void setPrintArea(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow)(Code)
For the Convenience of Java Programmers maintaining pointers.
See Also:   HSSFWorkbook.setPrintArea(int,String)
Parameters:
  sheetIndex - Zero-based sheet index (0 = First Sheet)
Parameters:
  startColumn - Column to begin printarea
Parameters:
  endColumn - Column to end the printarea
Parameters:
  startRow - Row to begin the printarea
Parameters:
  endRow - Row to end the printarea



setRepeatingRowsAndColumns
public void setRepeatingRowsAndColumns(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow)(Code)
Sets the repeating rows and columns for a sheet (as found in File->PageSetup->Sheet). This is function is included in the workbook because it creates/modifies name records which are stored at the workbook level.

To set just repeating columns:

 workbook.setRepeatingRowsAndColumns(0,0,1,-1-1);
 
To set just repeating rows:
 workbook.setRepeatingRowsAndColumns(0,-1,-1,0,4);
 
To remove all repeating rows and columns for a sheet.
 workbook.setRepeatingRowsAndColumns(0,-1,-1,-1,-1);
 

Parameters:
  sheetIndex - 0 based index to sheet.
Parameters:
  startColumn - 0 based start of repeating columns.
Parameters:
  endColumn - 0 based end of repeating columns.
Parameters:
  startRow - 0 based start of repeating rows.
Parameters:
  endRow - 0 based end of repeating rows.



setSelectedTab
public void setSelectedTab(short index)(Code)
sets the tab whose data is actually seen when the sheet is opened. This may be different from the "selected sheet" since excel seems to allow you to show the data of one sheet when another is seen "selected" in the tabs (at the bottom).
See Also:   org.apache.poi.hssf.usermodel.HSSFSheet.setSelected(boolean)
Parameters:
  index -



setSheetName
public void setSheetName(int sheet, String name)(Code)
set the sheet name. Will throw IllegalArgumentException if the name is greater than 31 chars or contains /\?*[]
Parameters:
  sheet - number (0 based)



setSheetName
public void setSheetName(int sheet, String name, short encoding)(Code)
set the sheet name forcing the encoding. Forcing the encoding IS A BAD IDEA!!!
throws:
  IllegalArgumentException - if the name is greater than 31 charsor contains /\?*[]
Parameters:
  sheet - number (0 based)



setSheetOrder
public void setSheetOrder(String sheetname, int pos)(Code)
sets the order of appearance for a given sheet.
Parameters:
  sheetname - the name of the sheet to reorder
Parameters:
  pos - the position that we want to insert the sheet into (0 based)



unwriteProtectWorkbook
public void unwriteProtectWorkbook()(Code)
removes the write protect flag



write
public void write(OutputStream stream) throws IOException(Code)
Method write - write out this workbook to an Outputstream. Constructs a new POI POIFSFileSystem, passes in the workbook binary representation and writes it out.
Parameters:
  stream - - the java OutputStream you wish to write the XLS to
exception:
  IOException - if anything can't be written.
See Also:   org.apache.poi.poifs.filesystem.POIFSFileSystem



writeProtectWorkbook
public void writeProtectWorkbook(String password, String username)(Code)
protect a workbook with a password (not encypted, just sets writeprotect flags and the password.
Parameters:
  password - to set



Fields inherited from org.apache.poi.POIDocument
protected DocumentSummaryInformation dsInf(Code)(Java Doc)
protected POIFSFileSystem filesystem(Code)(Java Doc)
protected POILogger logger(Code)(Java Doc)
protected SummaryInformation sInf(Code)(Java Doc)

Methods inherited from org.apache.poi.POIDocument
protected void copyNodes(POIFSFileSystem source, POIFSFileSystem target, List excepts) throws IOException(Code)(Java Doc)
public DocumentSummaryInformation getDocumentSummaryInformation()(Code)(Java Doc)
protected PropertySet getPropertySet(String setName)(Code)(Java Doc)
public SummaryInformation getSummaryInformation()(Code)(Java Doc)
protected void readProperties()(Code)(Java Doc)
protected void writeProperties(POIFSFileSystem outFS) throws IOException(Code)(Java Doc)
protected void writeProperties(POIFSFileSystem outFS, List writtenEntries) throws IOException(Code)(Java Doc)
protected void writePropertySet(String name, PropertySet set, POIFSFileSystem outFS) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.