org.apache.poi.hssf.util
Class HSSFCellUtil

java.lang.Object
  extended by org.apache.poi.hssf.util.HSSFCellUtil

Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil instead.

public final class HSSFCellUtil
extends java.lang.Object

Various utility functions that make working with a cells and rows easier. The various methods that deal with style's allow you to create your HSSFCellStyles as you need them. When you apply a style change to a cell, the code will attempt to see if a style already exists that meets your needs. If not, then it will create a new style. This is to prevent creating too many styles. there is an upper limit in Excel on the number of styles that can be supported.


Method Summary
static HSSFCell createCell(HSSFRow row, int column, java.lang.String value)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.createCell(org.apache.poi.ss.usermodel.Row, int, java.lang.String, org.apache.poi.ss.usermodel.CellStyle) instead.
static HSSFCell createCell(HSSFRow row, int column, java.lang.String value, HSSFCellStyle style)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.createCell(org.apache.poi.ss.usermodel.Row, int, java.lang.String, org.apache.poi.ss.usermodel.CellStyle) instead.
static HSSFCell getCell(HSSFRow row, int columnIndex)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.getCell(org.apache.poi.ss.usermodel.Row, int) instead.
static HSSFRow getRow(int rowIndex, HSSFSheet sheet)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.getRow(int, org.apache.poi.ss.usermodel.Sheet) instead.
static void setAlignment(HSSFCell cell, HSSFWorkbook workbook, short align)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.setAlignment(org.apache.poi.ss.usermodel.Cell, org.apache.poi.ss.usermodel.Workbook, short) instead.
static void setCellStyleProperty(HSSFCell cell, HSSFWorkbook workbook, java.lang.String propertyName, java.lang.Object propertyValue)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.setCellStyleProperty(org.apache.poi.ss.usermodel.Cell, org.apache.poi.ss.usermodel.Workbook, java.lang.String, java.lang.Object) instead.
static void setFont(HSSFCell cell, HSSFWorkbook workbook, HSSFFont font)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.setFont(org.apache.poi.ss.usermodel.Cell, org.apache.poi.ss.usermodel.Workbook, org.apache.poi.ss.usermodel.Font) instead.
static HSSFCell translateUnicodeValues(HSSFCell cell)
          Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.translateUnicodeValues(org.apache.poi.ss.usermodel.Cell) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRow

public static HSSFRow getRow(int rowIndex,
                             HSSFSheet sheet)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.getRow(int, org.apache.poi.ss.usermodel.Sheet) instead.

Get a row from the spreadsheet, and create it if it doesn't exist.

Parameters:
rowIndex - The 0 based row number
sheet - The sheet that the row is part of.
Returns:
The row indicated by the rowCounter

getCell

public static HSSFCell getCell(HSSFRow row,
                               int columnIndex)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.getCell(org.apache.poi.ss.usermodel.Row, int) instead.

Get a specific cell from a row. If the cell doesn't exist, then create it.

Parameters:
row - The row that the cell is part of
columnIndex - The column index that the cell is in.
Returns:
The cell indicated by the column.

createCell

public static HSSFCell createCell(HSSFRow row,
                                  int column,
                                  java.lang.String value,
                                  HSSFCellStyle style)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.createCell(org.apache.poi.ss.usermodel.Row, int, java.lang.String, org.apache.poi.ss.usermodel.CellStyle) instead.

Creates a cell, gives it a value, and applies a style if provided

Parameters:
row - the row to create the cell in
column - the column index to create the cell in
value - The value of the cell
style - If the style is not null, then set
Returns:
A new HSSFCell

createCell

public static HSSFCell createCell(HSSFRow row,
                                  int column,
                                  java.lang.String value)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.createCell(org.apache.poi.ss.usermodel.Row, int, java.lang.String, org.apache.poi.ss.usermodel.CellStyle) instead.

Create a cell, and give it a value.

Parameters:
row - the row to create the cell in
column - the column index to create the cell in
value - The value of the cell
Returns:
A new HSSFCell.

setAlignment

public static void setAlignment(HSSFCell cell,
                                HSSFWorkbook workbook,
                                short align)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.setAlignment(org.apache.poi.ss.usermodel.Cell, org.apache.poi.ss.usermodel.Workbook, short) instead.

Take a cell, and align it.

Parameters:
cell - the cell to set the alignment for
workbook - The workbook that is being worked with.
align - the column alignment to use.
See Also:
for alignment options

setFont

public static void setFont(HSSFCell cell,
                           HSSFWorkbook workbook,
                           HSSFFont font)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.setFont(org.apache.poi.ss.usermodel.Cell, org.apache.poi.ss.usermodel.Workbook, org.apache.poi.ss.usermodel.Font) instead.

Take a cell, and apply a font to it

Parameters:
cell - the cell to set the alignment for
workbook - The workbook that is being worked with.
font - The HSSFFont that you want to set.

setCellStyleProperty

public static void setCellStyleProperty(HSSFCell cell,
                                        HSSFWorkbook workbook,
                                        java.lang.String propertyName,
                                        java.lang.Object propertyValue)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.setCellStyleProperty(org.apache.poi.ss.usermodel.Cell, org.apache.poi.ss.usermodel.Workbook, java.lang.String, java.lang.Object) instead.

This method attempt to find an already existing HSSFCellStyle that matches what you want the style to be. If it does not find the style, then it creates a new one. If it does create a new one, then it applies the propertyName and propertyValue to the style. This is necessary because Excel has an upper limit on the number of Styles that it supports.

Parameters:
workbook - The workbook that is being worked with.
propertyName - The name of the property that is to be changed.
propertyValue - The value of the property that is to be changed.
cell - The cell that needs it's style changes

translateUnicodeValues

public static HSSFCell translateUnicodeValues(HSSFCell cell)
Deprecated. 3.15 beta2. Removed in 3.17. Use CellUtil.translateUnicodeValues(org.apache.poi.ss.usermodel.Cell) instead.

Looks for text in the cell that should be unicode, like α and provides the unicode version of it.

Parameters:
cell - The cell to check for unicode values
Returns:
translated to unicode (the cell is modified in-place and returned)


Copyright 2016 The Apache Software Foundation or its licensors, as applicable.