public class BHiveExcelCommand extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,ExcelColumn> |
anntationMap
Excel 출력 ExcelColumn Annotation 맵
|
protected Map<String,Short> |
columnAlignMap
Excel 출력 컬럼 정렬 Map
|
protected Map<String,Integer> |
columnOrderMap
Excel 출력 컬럼 순서 Map.
|
protected org.supercsv.io.ICsvBeanWriter |
csvWriter
CSV Writer
|
protected List |
dataList
출력할 데이터셋
|
static String |
EXTENSION_CSV |
static String |
EXTENSTION
확장자
|
protected Map<String,Map<String,String>> |
fieldCodeMapList
Excel 출력 코드표 치환 맵
|
protected String |
filename
다운로드 파일명
|
protected Map<String,String> |
groupHeaderMap
Excel 출력 그룹 헤더 맵 (국제화 적용)
|
protected boolean |
hasGroupHeaderMap
그룹헤더가 있는지 여부
|
protected Map<String,String> |
headerMap
Excel 출력 헤더 맵 (국제화 적용)
|
protected static org.slf4j.Logger |
logger |
protected BHiveExcelMergeMode |
mergeMode
출력데이터의 가로,세로 병합을 처리하기 위한 병합처리모드
|
protected String |
messagePrefix
메시지 소스를 통한 메시지 변환시 사용하는 Message Prefix
|
protected org.springframework.context.MessageSource |
messageSource
메시지 소스
|
protected Class<?> |
metadataClass
출력한 데이터 아이템의 메타정보 클래스.
|
static String |
MODEL_KEY
모델에 담을때 사용하는 Key
|
protected org.joda.time.DateTime |
now
현재시간(출력용)
|
protected javax.servlet.http.HttpServletRequest |
request
요청객체
|
protected javax.servlet.http.HttpServletResponse |
response
응답객체
|
protected String |
sheetName
엑셀 SheetName
|
protected String |
title
엑셀내 출력 제목(출력용)
|
protected org.apache.poi.hssf.usermodel.HSSFWorkbook |
workbook
엑셀 워크북
|
| Constructor and Description |
|---|
BHiveExcelCommand(List dataList,
Class<?> metadataClass,
org.springframework.context.MessageSource messageSource)
생성자
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCodeMap(String field,
List codeDTList,
String valueProp,
String nameProp)
출력용 필드 코드표를 추가
|
void |
addCodeMap(String field,
Map<String,String> fieldCodeMap)
출력용 필드 코드표를 추가
|
protected void |
applyColumnHidden(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet)
컬럼 숨김적용
|
protected void |
applyColumnWidth(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet)
컬럼폭 적용 (기본: 자동폭 계산)
|
protected void |
applyDataCellMergeMode(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int rownum)
Merge Mode에 따른 Data Cell 병합
|
void |
buildCsvDocument(Map<String,Object> model,
org.supercsv.io.ICsvBeanWriter csvWriter,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
CSV 생성.
|
void |
buildExcelDocument(org.apache.poi.hssf.usermodel.HSSFWorkbook workbook,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
엑셀 생성 (MAIN Start Method)
|
protected void |
checkDataItemTypeWithMetadataClass()
오류발생시 Metadata의 클래스 호환성 확인
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createCustomCellStyle(short bgColor,
org.apache.poi.ss.usermodel.HorizontalAlignment align,
org.apache.poi.ss.usermodel.VerticalAlignment valign)
출력용 CellStyle 생성
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createCustomCellStyle(short bgColor,
org.apache.poi.ss.usermodel.HorizontalAlignment align,
org.apache.poi.ss.usermodel.VerticalAlignment valign,
org.apache.poi.hssf.usermodel.HSSFFont font)
출력용 CellStyle 생성 (폰트 적용)
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createCustomCellStyle(short bgColor,
org.apache.poi.ss.usermodel.HorizontalAlignment align,
org.apache.poi.ss.usermodel.VerticalAlignment valign,
short fontHeightInPoints,
short fontColor,
boolean boldWeight,
byte underline)
출력용 CellStyle 생성 (폰트 속성 적용)
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createDataCellStyle(org.apache.poi.ss.usermodel.HorizontalAlignment align)
Data 출력용 Style
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createHeaderCellStyle()
헤더 출력용 Style
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createSubTitleCellStyle()
부제목 출력용 Style
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createTitleCellStyle()
제목 출력용 Style
|
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createTitleCellStyle(short fontHeightInPoints,
boolean setBorder) |
protected org.apache.poi.hssf.usermodel.HSSFCellStyle |
createTitleCellStyle(short fontHeightInPoints,
short fontColor,
byte underline,
boolean setBorder) |
BHiveExcelMergeMode |
getMergeMode() |
String |
getSheetName() |
String |
getTitle() |
protected static void |
mergeHorizontal(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnum,
int colSpan)
엑셀 셀을 가로 Merge
|
protected void |
mergeHorizontalByColumnCount(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int atRownum)
주어진 줄을 컬럼수만큼 가로병합(주로 제목부분 줄에 적용)
|
protected static void |
mergeHorizontalCellHasEqualValue(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnumStart,
int cellnumEnd)
특정 Row의 가로방향으로 값이 같으면 Merge
|
protected static void |
mergeRange(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnum,
int rowSpan,
int colSpan)
엑셀 셀을 Range Merge
|
protected static void |
mergeVertical(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnum,
int rowSpan)
엑셀 셀을 세로 Merge
|
protected void |
mergeVerticalAtAllColumn(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int dataRownumMax)
컬럼데이터를 세로 Merge
|
protected static void |
mergeVerticalCellHasEqualValue(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int cellnum,
int dataRownumStarted,
int dataRownumMax,
boolean hierarchy,
int cellnumMax)
특정 Column의 세로방향으로 값이 같으면 Merge
|
protected void |
mergeVerticalHierarchyAtAllColumn(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int dataRownumMax)
컬럼데이터를 세로 Merge, 앞에서 부터 HIERARCHY 방식 사용 (1열이 7줄 합쳐지면 2열은 그 경계를 초과하여 합치치 않음)
|
protected void |
postRenderSheet(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int rownum)
렌더링 후 처리
|
protected void |
prepareMetadata()
Metadata 클래스에서 출력을 위한 설정정보맵 구성
|
protected static void |
renderCustomCellValue(org.apache.poi.hssf.usermodel.HSSFRow excelRow,
int cellnum,
String cellValue,
org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)
Excel Row의 특정 Cell에 값을 렌더링 (스타일 적용가능)
|
protected static void |
renderCustomCellValue(org.apache.poi.hssf.usermodel.HSSFRow excelRow,
int cellnum,
String cellValue,
org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle,
int colSpan,
int rowSpan)
Excel Row의 특정 Cell에 값을 렌더링 (스타일 적용가능)
|
protected int |
renderCustomSubTitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
서브타이틀 직후 커스텀 출력
|
protected int |
renderCustomTitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
타이틀 직후 커스텀 출력
|
protected int |
renderExcelHeader(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
헤더 렌더링
|
protected int |
renderExcelRows(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
데이터 렌더링
|
protected int |
renderSubtitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
서브 타이틀 출력 (누가, 언제 출력)
|
protected int |
renderTitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
타이틀 출력
|
void |
setFilename(String filename) |
void |
setMergeMode(BHiveExcelMergeMode mergeMode) |
protected void |
setResponseCSVHeader()
CSV 응답헤더 설정 (다운로드 파일명등...)
|
protected void |
setResponseHeader()
응답헤더 설정 (다운로드 파일명등...)
|
void |
setSheetName(String sheetName) |
void |
setTitle(String title) |
protected static final org.slf4j.Logger logger
public static final String MODEL_KEY
public static final String EXTENSTION
public static final String EXTENSION_CSV
protected String messagePrefix
protected org.springframework.context.MessageSource messageSource
protected String filename
protected String title
protected String sheetName
protected List dataList
protected Class<?> metadataClass
protected BHiveExcelMergeMode mergeMode
protected Map<String,ExcelColumn> anntationMap
protected boolean hasGroupHeaderMap
protected org.joda.time.DateTime now
protected org.apache.poi.hssf.usermodel.HSSFWorkbook workbook
protected org.supercsv.io.ICsvBeanWriter csvWriter
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
public void setFilename(String filename)
public void addCodeMap(String field, List codeDTList, String valueProp, String nameProp) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
field - 코드표를 적용할 필드codeDTList - 코드표를 만들어 낼 코드DT 목록valueProp - 코드DT의 값 속성명nameProp - 코드DT의 이름 속성명IllegalAccessException - throw illegal access exceptionInvocationTargetException - throw invocation target exceptionNoSuchMethodException - throw no such method exceptionpublic void addCodeMap(String field, Map<String,String> fieldCodeMap)
field - 코드표를 적용할 필드fieldCodeMap - 코드표, value-name 쌍protected org.apache.poi.hssf.usermodel.HSSFCellStyle createCustomCellStyle(short bgColor,
org.apache.poi.ss.usermodel.HorizontalAlignment align,
org.apache.poi.ss.usermodel.VerticalAlignment valign,
org.apache.poi.hssf.usermodel.HSSFFont font)
bgColor - background color to usealign - align to usevalign - vertical align to usefont - font to useprotected org.apache.poi.hssf.usermodel.HSSFCellStyle createCustomCellStyle(short bgColor,
org.apache.poi.ss.usermodel.HorizontalAlignment align,
org.apache.poi.ss.usermodel.VerticalAlignment valign,
short fontHeightInPoints,
short fontColor,
boolean boldWeight,
byte underline)
bgColor - background color to usealign - align to usevalign - vertical align to usefontHeightInPoints - font height in points to usefontColor - font color to useboldWeight - boldweight to useunderline - under line to useprotected org.apache.poi.hssf.usermodel.HSSFCellStyle createCustomCellStyle(short bgColor,
org.apache.poi.ss.usermodel.HorizontalAlignment align,
org.apache.poi.ss.usermodel.VerticalAlignment valign)
bgColor - background color to usealign - align to usevalign - vertical align to useprotected org.apache.poi.hssf.usermodel.HSSFCellStyle createTitleCellStyle()
protected org.apache.poi.hssf.usermodel.HSSFCellStyle createTitleCellStyle(short fontHeightInPoints,
short fontColor,
byte underline,
boolean setBorder)
protected org.apache.poi.hssf.usermodel.HSSFCellStyle createTitleCellStyle(short fontHeightInPoints,
boolean setBorder)
protected org.apache.poi.hssf.usermodel.HSSFCellStyle createSubTitleCellStyle()
protected org.apache.poi.hssf.usermodel.HSSFCellStyle createHeaderCellStyle()
protected org.apache.poi.hssf.usermodel.HSSFCellStyle createDataCellStyle(org.apache.poi.ss.usermodel.HorizontalAlignment align)
align - align to useprotected static void renderCustomCellValue(org.apache.poi.hssf.usermodel.HSSFRow excelRow,
int cellnum,
String cellValue,
org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)
excelRow - HSSFRow excelRowcellnum - int cell numbercellValue - String cell valuecellStyle - HSSFCellStyle objectprotected static void renderCustomCellValue(org.apache.poi.hssf.usermodel.HSSFRow excelRow,
int cellnum,
String cellValue,
org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle,
int colSpan,
int rowSpan)
excelRow - HSSFRow excelRowcellnum - int cell numbercellValue - String cell valuecellStyle - HSSFCellStyle objectcolSpan - col span valuerowSpan - row span valuepublic void buildExcelDocument(org.apache.poi.hssf.usermodel.HSSFWorkbook workbook,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
workbook - HSSFRow excelRowrequest - HttpServletRequest request objectresponse - HttpServletResponse response objectprotected void checkDataItemTypeWithMetadataClass()
protected void prepareMetadata()
throws IntrospectionException
IntrospectionException - throws Intro spection Exceptionprotected int renderTitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
excelSheet - HSSFSheet objectrownum - int rownumprotected int renderCustomTitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
excelSheet - HSSFSheet objectrownum - int rownumprotected int renderSubtitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
excelSheet - HSSFSheet objectrownum - int rownumprotected int renderCustomSubTitle(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
excelSheet - HSSFSheet objectrownum - int rownumprotected int renderExcelHeader(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
excelSheet - HSSFSheet objectrownum - int rownumprotected int renderExcelRows(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
excelSheet - HSSFSheet objectrownum - int rownumIllegalAccessException - throws IllegalAccess ExceptionInvocationTargetException - throws Invocation Target ExceptionNoSuchMethodException - throws No Such Method Exceptionprotected void postRenderSheet(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int rownum)
throws UnsupportedEncodingException
excelSheet - HSSFSheet objectdataRownumStarted - 데이터 출력 시작 위치rownum - 최종 출력 위치UnsupportedEncodingException - Unsupported Encoding Exceptionprotected void applyColumnWidth(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet)
excelSheet - HSSFSheet objectprotected void applyDataCellMergeMode(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int rownum)
excelSheet - HSSFSheet objectdataRownumStarted - 처리 시작 row indexrownum - int 처리할 row 갯수protected void applyColumnHidden(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet)
excelSheet - HSSFSheet objectprotected void setResponseHeader()
throws UnsupportedEncodingException
UnsupportedEncodingException - throws Un supported Encoding Exceptionprotected static void mergeHorizontal(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnum,
int colSpan)
excelSheet - 엑셀 시트rownum - 대상셀 RowIndexcellnum - 대상셀 ColumnIndexcolSpan - 가로 셀 폭protected static void mergeVertical(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnum,
int rowSpan)
excelSheet - 엑셀 시트rownum - 대상셀 RowIndexcellnum - 대상셀 ColumnIndexrowSpan - 세로 셀 폭protected static void mergeRange(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnum,
int rowSpan,
int colSpan)
excelSheet - 엑셀 시트rownum - 대상셀 RowIndexcellnum - 대상셀 ColumnIndexrowSpan - 세로 셀 폭colSpan - 가로 셀 폭protected void mergeHorizontalByColumnCount(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int atRownum)
excelSheet - 가로 병합할 sheetatRownum - 병합할 row indexprotected void mergeVerticalAtAllColumn(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int dataRownumMax)
excelSheet - 가로 병합할 sheetdataRownumStarted - 병합시작할 row indexdataRownumMax - 병합할 최대 row 갯수protected void mergeVerticalHierarchyAtAllColumn(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int dataRownumStarted,
int dataRownumMax)
excelSheet - 가로 병합할 sheetdataRownumStarted - 병합시작할 row indexdataRownumMax - 병합할 최대 row 갯수protected static void mergeVerticalCellHasEqualValue(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int cellnum,
int dataRownumStarted,
int dataRownumMax,
boolean hierarchy,
int cellnumMax)
excelSheet - 시트cellnum - 처리할 Column의 CellNumdataRownumStarted - 시작 RownumdataRownumMax - 종료 Rownum (초과경계값)hierarchy - 트리형으로 적용cellnumMax - 최대 Cellnum (초과경계값)protected static void mergeHorizontalCellHasEqualValue(org.apache.poi.hssf.usermodel.HSSFSheet excelSheet,
int rownum,
int cellnumStart,
int cellnumEnd)
excelSheet - 시트rownum - 줄번호cellnumStart - 컬럼시작cellnumEnd - 컬럼끝 (초과경계값)public void buildCsvDocument(Map<String,Object> model, org.supercsv.io.ICsvBeanWriter csvWriter, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
model - CSV 로 생성할 데이터csvWriter - ICsvBeanWriter objectrequest - HttpServletRequest objectresponse - HttpServletResponse objectprotected void setResponseCSVHeader()
throws IOException
IOException - throws IO Exceptionpublic String getTitle()
public void setTitle(String title)
public String getSheetName()
public void setSheetName(String sheetName)
public BHiveExcelMergeMode getMergeMode()
public void setMergeMode(BHiveExcelMergeMode mergeMode)
Copyright © 2018. All rights reserved.