Package adams.core

Class ExcelHelper


  • public class ExcelHelper
    extends Object
    Helper class for Excel-related stuff.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • ExcelHelper

        public ExcelHelper()
    • Method Detail

      • getCellLocation

        public static int[] getCellLocation​(String position)
                                     throws Exception
        Returns row/column index based on the provided position string (e.g., A12).
        Parameters:
        position - the position string to parse
        Returns:
        the array with row and column index (0-based indices)
        Throws:
        Exception - in case of an invalid position string
      • getColumnPosition

        public static String getColumnPosition​(int col)
        Returns the position letter(s) of the column.
        Parameters:
        col - the column index of the cell (0-based)
        Returns:
        the position string
      • getCellPosition

        public static String getCellPosition​(int row,
                                             int col)
        Returns the position of the cell. A position is a combination of a number of letters (for the column) and number (for the row).
        Parameters:
        row - the row index of the cell (0-based)
        col - the column index of the cell (0-based)
        Returns:
        the position string or null if not found
      • getDateCellStyle

        public static org.apache.poi.ss.usermodel.CellStyle getDateCellStyle​(org.apache.poi.ss.usermodel.Workbook wb,
                                                                             String format)
        Creates a cellstyle for a date cell with the specified format.
        Parameters:
        wb - the workbook to use this format for
        format - the format to use
        Returns:
        the generated style