Java Doc for HSSFCell.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.hssf.usermodel.HSSFCell

HSSFCell
public class HSSFCell (Code)
High level representation of a cell in a row of a spreadsheet. Cells can be numeric, formula-based or string-based (text). The cell type specifies this. String cells cannot conatin numbers and numeric cells cannot contain strings (at least according to our model). Client apps should do the conversions themselves. Formula cells have the formula string, as well as the formula result, which can be numeric or string.

Cells should have their number (0 based) before being added to a row. Only cells that have values should be added.


author:
   Andrew C. Oliver (acoliver at apache dot org)
author:
   Dan Sherman (dsherman at isisph.com)
author:
   Brian Sanders (kestrel at burdell dot org) Active Cell support
author:
   Yegor Kozlov cell comments support
version:
   1.0-pre



Field Summary
final public static  intCELL_TYPE_BLANK
    
final public static  intCELL_TYPE_BOOLEAN
    
final public static  intCELL_TYPE_ERROR
    
final public static  intCELL_TYPE_FORMULA
    
final public static  intCELL_TYPE_NUMERIC
    
final public static  intCELL_TYPE_STRING
    
final public static  shortENCODING_COMPRESSED_UNICODE
    
final public static  shortENCODING_UNCHANGED
    
final public static  shortENCODING_UTF_16
    

Constructor Summary
protected  HSSFCell(Workbook book, Sheet sheet, int row, short col)
     Creates new Cell - Should only be called by HSSFRow.
protected  HSSFCell(Workbook book, Sheet sheet, int row, short col, int type)
     Creates new Cell - Should only be called by HSSFRow.
protected  HSSFCell(Workbook book, Sheet sheet, int row, CellValueRecordInterface cval)
     Creates an HSSFCell from a CellValueRecordInterface.

Method Summary
protected static  HSSFCommentfindCellComment(Sheet sheet, int row, int column)
     Cell comment finder.
public  booleangetBooleanCellValue()
     get the value of the cell as a boolean.
protected  WorkbookgetBoundWorkbook()
    
public  HSSFCommentgetCellComment()
    
public  StringgetCellFormula()
    
public  shortgetCellNum()
    
public  HSSFCellStylegetCellStyle()
     get the style for the cell.
public  intgetCellType()
    
protected  CellValueRecordInterfacegetCellValueRecord()
     Should only be used by HSSFSheet and friends.
public  DategetDateCellValue()
     get the value of the cell as a date.
public  shortgetEncoding()
    
public  bytegetErrorCellValue()
     get the value of the cell as an error code.
public  doublegetNumericCellValue()
     get the value of the cell as a number.
public  HSSFRichTextStringgetRichStringCellValue()
     get the value of the cell as a string - for numeric cells we throw an exception.
public  StringgetStringCellValue()
     get the value of the cell as a string - for numeric cells we throw an exception.
public  voidsetAsActiveCell()
    
public  voidsetCellComment(HSSFComment comment)
    
public  voidsetCellErrorValue(byte value)
     set a error value for the cell
Parameters:
  value - the error value to set this cell to.
public  voidsetCellFormula(String formula)
    
public  voidsetCellNum(short num)
    
public  voidsetCellStyle(HSSFCellStyle style)
     set the style for the cell.
public  voidsetCellType(int cellType)
    
public  voidsetCellValue(double value)
     set a numeric value for the cell
Parameters:
  value - the numeric value to set this cell to.
public  voidsetCellValue(Date value)
     set a date value for the cell.
public  voidsetCellValue(Calendar value)
     set a date value for the cell.
public  voidsetCellValue(String value)
     set a string value for the cell.
public  voidsetCellValue(HSSFRichTextString value)
     set a string value for the cell.
public  voidsetCellValue(boolean value)
     set a boolean value for the cell
Parameters:
  value - the boolean value to set this cell to.
public  voidsetEncoding(short encoding)
     set the encoding to either 8 or 16 bit.
public  StringtoString()
     Returns a string representation of the cell This method returns a simple representation, anthing more complex should be in user code, with knowledge of the semantics of the sheet being processed.

Field Detail
CELL_TYPE_BLANK
final public static int CELL_TYPE_BLANK(Code)
Blank Cell type (3)
See Also:   HSSFCell.setCellType(int)
See Also:   HSSFCell.getCellType()



CELL_TYPE_BOOLEAN
final public static int CELL_TYPE_BOOLEAN(Code)
Boolean Cell type (4)
See Also:   HSSFCell.setCellType(int)
See Also:   HSSFCell.getCellType()



CELL_TYPE_ERROR
final public static int CELL_TYPE_ERROR(Code)
Error Cell type (5)
See Also:   HSSFCell.setCellType(int)
See Also:   HSSFCell.getCellType()



CELL_TYPE_FORMULA
final public static int CELL_TYPE_FORMULA(Code)
Formula Cell type (2)
See Also:   HSSFCell.setCellType(int)
See Also:   HSSFCell.getCellType()



CELL_TYPE_NUMERIC
final public static int CELL_TYPE_NUMERIC(Code)
Numeric Cell type (0)
See Also:   HSSFCell.setCellType(int)
See Also:   HSSFCell.getCellType()



CELL_TYPE_STRING
final public static int CELL_TYPE_STRING(Code)
String Cell type (1)
See Also:   HSSFCell.setCellType(int)
See Also:   HSSFCell.getCellType()



ENCODING_COMPRESSED_UNICODE
final public static short ENCODING_COMPRESSED_UNICODE(Code)



ENCODING_UNCHANGED
final public static short ENCODING_UNCHANGED(Code)



ENCODING_UTF_16
final public static short ENCODING_UTF_16(Code)




Constructor Detail
HSSFCell
protected HSSFCell(Workbook book, Sheet sheet, int row, short col)(Code)
Creates new Cell - Should only be called by HSSFRow. This creates a cell from scratch.

When the cell is initially created it is set to CELL_TYPE_BLANK. Cell types can be changed/overwritten by calling setCellValue with the appropriate type as a parameter although conversions from one type to another may be prohibited.
Parameters:
  book - - Workbook record of the workbook containing this cell
Parameters:
  sheet - - Sheet record of the sheet containing this cell
Parameters:
  row - - the row of this cell
Parameters:
  col - - the column for this cell
See Also:   org.apache.poi.hssf.usermodel.HSSFRow.createCell(short)




HSSFCell
protected HSSFCell(Workbook book, Sheet sheet, int row, short col, int type)(Code)
Creates new Cell - Should only be called by HSSFRow. This creates a cell from scratch.
Parameters:
  book - - Workbook record of the workbook containing this cell
Parameters:
  sheet - - Sheet record of the sheet containing this cell
Parameters:
  row - - the row of this cell
Parameters:
  col - - the column for this cell
Parameters:
  type - - CELL_TYPE_NUMERIC, CELL_TYPE_STRING, CELL_TYPE_FORMULA, CELL_TYPE_BLANK,CELL_TYPE_BOOLEAN, CELL_TYPE_ERRORType of cell
See Also:   org.apache.poi.hssf.usermodel.HSSFRow.createCell(shortint)



HSSFCell
protected HSSFCell(Workbook book, Sheet sheet, int row, CellValueRecordInterface cval)(Code)
Creates an HSSFCell from a CellValueRecordInterface. HSSFSheet uses this when reading in cells from an existing sheet.
Parameters:
  book - - Workbook record of the workbook containing this cell
Parameters:
  sheet - - Sheet record of the sheet containing this cell
Parameters:
  cval - - the Cell Value Record we wish to represent




Method Detail
findCellComment
protected static HSSFComment findCellComment(Sheet sheet, int row, int column)(Code)
Cell comment finder. Returns cell comment for the specified sheet, row and column. cell comment or null if not found



getBooleanCellValue
public boolean getBooleanCellValue()(Code)
get the value of the cell as a boolean. For strings, numbers, and errors, we throw an exception. For blank cells we return a false.



getBoundWorkbook
protected Workbook getBoundWorkbook()(Code)
Returns the Workbook that this Cell is bound to



getCellComment
public HSSFComment getCellComment()(Code)
Returns comment associated with this cell comment associated with this cell



getCellFormula
public String getCellFormula()(Code)



getCellNum
public short getCellNum()(Code)
get the cell's number within the row short reperesenting the column number (logical!)



getCellStyle
public HSSFCellStyle getCellStyle()(Code)
get the style for the cell. This is a reference to a cell style contained in the workbook object.
See Also:   org.apache.poi.hssf.usermodel.HSSFWorkbook.getCellStyleAt(short)



getCellType
public int getCellType()(Code)
get the cells type (numeric, formula or string)
See Also:   HSSFCell.CELL_TYPE_STRING
See Also:   HSSFCell.CELL_TYPE_NUMERIC
See Also:   HSSFCell.CELL_TYPE_FORMULA
See Also:   HSSFCell.CELL_TYPE_BOOLEAN
See Also:   HSSFCell.CELL_TYPE_ERROR



getCellValueRecord
protected CellValueRecordInterface getCellValueRecord()(Code)
Should only be used by HSSFSheet and friends. Returns the low level CellValueRecordInterface record CellValueRecordInterface representing the cell via the low level api.



getDateCellValue
public Date getDateCellValue()(Code)
get the value of the cell as a date. For strings we throw an exception. For blank cells we return a null.



getEncoding
public short getEncoding()(Code)
used for internationalization, currently -1 for unchanged, 0 for compressed unicode or 1 for 16-bit
See Also:   HSSFCell.ENCODING_UNCHANGED
See Also:   HSSFCell.ENCODING_COMPRESSED_UNICODE
See Also:   HSSFCell.ENCODING_UTF_16 -1, 1 or 0 for unchanged, compressed or uncompressed (used only with String type)



getErrorCellValue
public byte getErrorCellValue()(Code)
get the value of the cell as an error code. For strings, numbers, and booleans, we throw an exception. For blank cells we return a 0.



getNumericCellValue
public double getNumericCellValue()(Code)
get the value of the cell as a number. For strings we throw an exception. For blank cells we return a 0.



getRichStringCellValue
public HSSFRichTextString getRichStringCellValue()(Code)
get the value of the cell as a string - for numeric cells we throw an exception. For blank cells we return an empty string. For formulaCells that are not string Formulas, we return empty String



getStringCellValue
public String getStringCellValue()(Code)
get the value of the cell as a string - for numeric cells we throw an exception. For blank cells we return an empty string. For formulaCells that are not string Formulas, we return empty String



setAsActiveCell
public void setAsActiveCell()(Code)
Sets this cell as the active cell for the worksheet



setCellComment
public void setCellComment(HSSFComment comment)(Code)
Assign a comment to this cell
Parameters:
  comment - comment associated with this cell



setCellErrorValue
public void setCellErrorValue(byte value)(Code)
set a error value for the cell
Parameters:
  value - the error value to set this cell to. For formulas we'll set theprecalculated value ??? IS THIS RIGHT??? , for errors we'll setits value. For other types we will change the cell to an errorcell and set its value.



setCellFormula
public void setCellFormula(String formula)(Code)



setCellNum
public void setCellNum(short num)(Code)
set the cell's number within the row (0 based)
Parameters:
  num - short the cell number



setCellStyle
public void setCellStyle(HSSFCellStyle style)(Code)
set the style for the cell. The style should be an HSSFCellStyle created/retreived from the HSSFWorkbook.
Parameters:
  style - reference contained in the workbook
See Also:   org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle
See Also:   org.apache.poi.hssf.usermodel.HSSFWorkbook.getCellStyleAt(short)



setCellType
public void setCellType(int cellType)(Code)
set the cells type (numeric, formula or string)
See Also:   HSSFCell.CELL_TYPE_NUMERIC
See Also:   HSSFCell.CELL_TYPE_STRING
See Also:   HSSFCell.CELL_TYPE_FORMULA
See Also:   HSSFCell.CELL_TYPE_BLANK
See Also:   HSSFCell.CELL_TYPE_BOOLEAN
See Also:   HSSFCell.CELL_TYPE_ERROR



setCellValue
public void setCellValue(double value)(Code)
set a numeric value for the cell
Parameters:
  value - the numeric value to set this cell to. For formulas we'll set theprecalculated value, for numerics we'll set its value. For other types wewill change the cell to a numeric cell and set its value.



setCellValue
public void setCellValue(Date value)(Code)
set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as a date.
Parameters:
  value - the date value to set this cell to. For formulas we'll set theprecalculated value, for numerics we'll set its value. For other types wewill change the cell to a numeric cell and set its value.



setCellValue
public void setCellValue(Calendar value)(Code)
set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as a date.
Parameters:
  value - the date value to set this cell to. For formulas we'll set theprecalculated value, for numerics we'll set its value. For othertypes wewill change the cell to a numeric cell and set its value.



setCellValue
public void setCellValue(String value)(Code)
set a string value for the cell. Please note that if you are using full 16 bit unicode you should call setEncoding() first.
Parameters:
  value - value to set the cell to. For formulas we'll set the formulastring, for String cells we'll set its value. For other types we willchange the cell to a string cell and set its value.If value is null then we will change the cell to a Blank cell.



setCellValue
public void setCellValue(HSSFRichTextString value)(Code)
set a string value for the cell. Please note that if you are using full 16 bit unicode you should call setEncoding() first.
Parameters:
  value - value to set the cell to. For formulas we'll set the formulastring, for String cells we'll set its value. For other types we willchange the cell to a string cell and set its value.If value is null then we will change the cell to a Blank cell.



setCellValue
public void setCellValue(boolean value)(Code)
set a boolean value for the cell
Parameters:
  value - the boolean value to set this cell to. For formulas we'll set theprecalculated value, for booleans we'll set its value. For other types wewill change the cell to a boolean cell and set its value.



setEncoding
public void setEncoding(short encoding)(Code)
set the encoding to either 8 or 16 bit. (US/UK use 8-bit, rest of the western world use 16bit)
See Also:   HSSFCell.ENCODING_UNCHANGED
See Also:   HSSFCell.ENCODING_COMPRESSED_UNICODE
See Also:   HSSFCell.ENCODING_UTF_16
Parameters:
  encoding - either ENCODING_COMPRESSED_UNICODE (0) or ENCODING_UTF_16 (1)



toString
public String toString()(Code)
Returns a string representation of the cell This method returns a simple representation, anthing more complex should be in user code, with knowledge of the semantics of the sheet being processed. Formula cells return the formula string, rather than the formula result. Dates are displayed in dd-MMM-yyyy format Errors are displayed as #ERR<errIdx>



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.