org.bbreak.excella.reports.util
クラス ReportsUtil

java.lang.Object
  上位を拡張 org.bbreak.excella.reports.util.ReportsUtil

public final class ReportsUtil
extends Object

帳票用ユーティリティクラス

導入されたバージョン:
1.0

フィールドの概要
static String VALUE_SHEET_NAMES
          システム変数:シート名
static String VALUE_SHEET_VALUES
          システム変数:シート値
 
メソッドの概要
static CellStyle[][] getBlockCellStyle(Sheet sheet, int bStartRowIndex, int bEndRowIndex, int bStartColIndex, int bEndColIndex)
          対象シートの指定された範囲のセルに書かれている文字列をCellStyle[行番号][列番号]の形式で取得する。
static int[][] getBlockCellType(Sheet sheet, int bStartRowIndex, int bEndRowIndex, int bStartColIndex, int bEndColIndex)
          対象シートの指定された範囲のセルのタイプint[行番号][列番号]の形式で取得する。
static Object[][] getBlockCellValue(Sheet sheet, int bStartRowIndex, int bEndRowIndex, int bStartColIndex, int bEndColIndex)
          対象シートの指定された範囲のセルに書かれている文字列をString[行番号][列番号]の形式で取得する。
static int[] getCellIndex(String cellParam, String tagName)
          オプション定義が範囲(XXXCell=n:n)から、nを数値で取得する。
static int[] getColumnWidth(Sheet sheet, int bStartColIndex, int bEndColIndex)
          対象シートの指定された範囲の列の高さをint[列番号]の形式で取得する。
static CellRangeAddress[] getMargedCells(Sheet sheet, int baseFromCellRowIndex, int baseToCellRowIndex, int baseFromCellColIndex, int baseToCellColIndex)
          対象シート上の基準範囲に含まれる結合セルの範囲を取得します。
static CellRangeAddress getMergedAddress(Sheet sheet, int rowIndex, int columnIndex)
          指定された行、列座標のセルを含む結合セルを取得する。
static List<Object> getParamValues(ParamInfo info, String propertyNameString, List<ReportsTagParser<?>> parsers)
          パラメータ情報(子パラメータを含む)より、置換変数名で指定されている変換値を取得する。
static ReportSheet getReportSheet(String sheetName, ReportBook reportBook)
          シート名と一致する帳票シート情報を取得する。
static float[] getRowHeight(Sheet sheet, int bStartRowIndex, int bEndRowIndex)
          対象シートの指定された範囲の行の高さをfloat[行番号]の形式で取得する。
static List<String> getSheetNames(ReportBook reportBook)
          シート名リストを取得する。
static List<Object> getSheetValues(ReportBook reportBook, String propertyName, List<ReportsTagParser<?>> parsers)
          シートの値を取得する。
static BigDecimal getSumValue(ParamInfo info, String propertyName, List<ReportsTagParser<?>> parsers)
          合計値を取得する。
static boolean isEmptyCell(int cellType, Object cellValue, CellStyle cellStyle)
          セルに情報(値、スタイル、タイプ)が設定されているかどうかの判定を行う
static boolean isEmptyRow(int[] rowCellTypes, Object[] rowCellValues, CellStyle[] rowCellStyles)
          行に情報(値、スタイル、タイプ)が設定されているかどうかの判定を行う
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

VALUE_SHEET_NAMES

public static final String VALUE_SHEET_NAMES
システム変数:シート名

関連項目:
定数フィールド値

VALUE_SHEET_VALUES

public static final String VALUE_SHEET_VALUES
システム変数:シート値

関連項目:
定数フィールド値
メソッドの詳細

getReportSheet

public static ReportSheet getReportSheet(String sheetName,
                                         ReportBook reportBook)
シート名と一致する帳票シート情報を取得する。

パラメータ:
sheetName - シート名
reportBook - 帳票ワークブック情報
戻り値:
シート名と一致する帳票シート情報

getSheetNames

public static List<String> getSheetNames(ReportBook reportBook)
シート名リストを取得する。

パラメータ:
reportBook - 帳票シート情報
戻り値:
シート名リスト

getParamValues

public static List<Object> getParamValues(ParamInfo info,
                                          String propertyNameString,
                                          List<ReportsTagParser<?>> parsers)
パラメータ情報(子パラメータを含む)より、置換変数名で指定されている変換値を取得する。
 置換変数文字列指定方法
 タグ名:置換変数名
 例)
 $R[]:金額
 $C:日付
 $:名前
 名前(単純置換の場合は『タグ名:』は省略可…『$:』が補完される)  
 
 ブロックタグ($BR[]、$BC[])は『.』で子パラメータを指定する。
 ブロックタグが複数でも連続して指定可能
  ブロックタグ名:置換変数名.ブロックタグ名:置換変数名.タグ名:置換変数名
 例)
 $BR[]:支店.$R[]:担当者
 $BR[]:支店.支店名
 

パラメータ:
info - パラメータ情報
propertyNameString - 置換変数文字列
parsers - 使用中のパーサ群
戻り値:
置換変数文字列に対応する変換値リスト

getSheetValues

public static List<Object> getSheetValues(ReportBook reportBook,
                                          String propertyName,
                                          List<ReportsTagParser<?>> parsers)
シートの値を取得する。

パラメータ:
reportBook - 帳票シート情報
propertyName - 単純置換変数
parsers - 使用中のパーサ群
戻り値:
各シートの変数値

getSumValue

public static BigDecimal getSumValue(ParamInfo info,
                                     String propertyName,
                                     List<ReportsTagParser<?>> parsers)
合計値を取得する。

パラメータ:
info - パラメータ情報
propertyName - 置換変数文字列
parsers - 使用中のパーサ群
戻り値:
合計値

getMergedAddress

public static CellRangeAddress getMergedAddress(Sheet sheet,
                                                int rowIndex,
                                                int columnIndex)
指定された行、列座標のセルを含む結合セルを取得する。

パラメータ:
sheet - 対象シート
rowIndex - 行インデックス
columnIndex - 列インデックス
戻り値:
結合セル

getCellIndex

public static int[] getCellIndex(String cellParam,
                                 String tagName)
                          throws ParseException
オプション定義が範囲(XXXCell=n:n)から、nを数値で取得する。

パラメータ:
cellParam - 範囲指定(n:n)
tagName - タグ名称(エラー時出力用)
戻り値:
intの配列(row、col)
例外:
ParseException

getBlockCellValue

public static Object[][] getBlockCellValue(Sheet sheet,
                                           int bStartRowIndex,
                                           int bEndRowIndex,
                                           int bStartColIndex,
                                           int bEndColIndex)
対象シートの指定された範囲のセルに書かれている文字列をString[行番号][列番号]の形式で取得する。 セルに書かれている値が文字列でない場合は、nullがセットされる。

パラメータ:
sheet - 対象となるシート
bStartRowIndex - 範囲開始行番号
bEndRowIndex - 範囲終了行番号
bStartColIndex - 範囲開始列番号
bEndColIndex - 範囲終了列番号
戻り値:
セル文字列

getBlockCellStyle

public static CellStyle[][] getBlockCellStyle(Sheet sheet,
                                              int bStartRowIndex,
                                              int bEndRowIndex,
                                              int bStartColIndex,
                                              int bEndColIndex)
対象シートの指定された範囲のセルに書かれている文字列をCellStyle[行番号][列番号]の形式で取得する。 セルの値がnullの場合、nullがセットされる。

パラメータ:
sheet - 対象となるシート
bStartRowIndex - 範囲開始行番号
bEndRowIndex - 範囲終了行番号
bStartColIndex - 範囲開始列番号
bEndColIndex - 範囲終了列番号
戻り値:
セルスタイル

getBlockCellType

public static int[][] getBlockCellType(Sheet sheet,
                                       int bStartRowIndex,
                                       int bEndRowIndex,
                                       int bStartColIndex,
                                       int bEndColIndex)
対象シートの指定された範囲のセルのタイプint[行番号][列番号]の形式で取得する。 セルの値がnullの場合、Cell.CELL_TYPE_BLANKがセットされる。

パラメータ:
sheet - 対象となるシート
bStartRowIndex - 範囲開始行番号
bEndRowIndex - 範囲終了行番号
bStartColIndex - 範囲開始列番号
bEndColIndex - 範囲終了列番号
戻り値:
セルのタイプ

getRowHeight

public static float[] getRowHeight(Sheet sheet,
                                   int bStartRowIndex,
                                   int bEndRowIndex)
対象シートの指定された範囲の行の高さをfloat[行番号]の形式で取得する。 行が存在しない場合には-1がセットされる。

パラメータ:
sheet - 対象となるシート
bStartRowIndex - 範囲開始行番号
bEndRowIndex - 範囲終了行番号
戻り値:
行の高さ

getColumnWidth

public static int[] getColumnWidth(Sheet sheet,
                                   int bStartColIndex,
                                   int bEndColIndex)
対象シートの指定された範囲の列の高さをint[列番号]の形式で取得する。

パラメータ:
sheet - 対象となるシート
bStartColIndex - 基準範囲の開始列
bEndColIndex - 基準範囲の終了列
戻り値:
列の高さ

getMargedCells

public static CellRangeAddress[] getMargedCells(Sheet sheet,
                                                int baseFromCellRowIndex,
                                                int baseToCellRowIndex,
                                                int baseFromCellColIndex,
                                                int baseToCellColIndex)
対象シート上の基準範囲に含まれる結合セルの範囲を取得します。

パラメータ:
sheet - 対象となるシート
baseFromCellRowIndex - 基準範囲の開始行
baseToCellRowIndex - 基準範囲の終了行
baseFromCellColIndex - 基準範囲の開始列
baseToCellColIndex - 基準範囲の終了列
戻り値:
結合セル範囲

isEmptyRow

public static boolean isEmptyRow(int[] rowCellTypes,
                                 Object[] rowCellValues,
                                 CellStyle[] rowCellStyles)
行に情報(値、スタイル、タイプ)が設定されているかどうかの判定を行う

パラメータ:
rowCellTypes - 対象行のセルスタイル
rowCellValues - 対象行のセルの値
rowCellStyles - 対象行のセルタイプ
戻り値:
行が空の場合はtrue、行に何らかの情報を持っている場合はfalse

isEmptyCell

public static boolean isEmptyCell(int cellType,
                                  Object cellValue,
                                  CellStyle cellStyle)
セルに情報(値、スタイル、タイプ)が設定されているかどうかの判定を行う

パラメータ:
cellType - 対象セルのスタイル
cellValue - 対象セルの値
cellStyle - 対象セルのタイプ
戻り値:
セルが空の場合はtrue、セルに何らかの情報を持っている場合はfalse