List of usage examples for org.apache.poi.ss.usermodel Sheet setColumnHidden
void setColumnHidden(int columnIndex, boolean hidden);
From source file:cn.afterturn.easypoi.excel.export.base.BaseExportService.java
License:Apache License
public void setColumnHidden(List<ExcelExportEntity> excelParams, Sheet sheet) { int index = 0; for (int i = 0; i < excelParams.size(); i++) { if (excelParams.get(i).getList() != null) { List<ExcelExportEntity> list = excelParams.get(i).getList(); for (int j = 0; j < list.size(); j++) { sheet.setColumnHidden(index, list.get(j).isColumnHidden()); index++;/*from w w w .ja va 2 s . com*/ } } else { sheet.setColumnHidden(index, excelParams.get(i).isColumnHidden()); index++; } } }
From source file:com.cms.utils.ExportExcell.java
/** * Tao cac sheet. Chua export ra file excell * * @param sheetName/* ww w . j ava2s .c o m*/ * @param lstData * @param formatExcell * @param key */ public void buildSheet(String sheetName, List<?> lstData, List<FormatExcell> formatExcell, String key) { Sheet sheetTmp = wb.createSheet(sheetName); FormatExcell item; Row rowheader = sheetTmp.createRow(0); ExportExcellCelltype customCellType = new ExportExcellCelltype(wb); Cell cellStt = rowheader.createCell(0); cellStt.setCellValue(BundleUtils.getString("STT")); cellStt.setCellStyle(customCellType.cellTypeColumnStt()); for (int i = 0; i < formatExcell.size(); i++) { item = formatExcell.get(i); Cell cell = rowheader.createCell(i + 1); cell.setCellValue(getColumnTitle(item.getCellColumn(), key)); cell.setCellStyle(customCellType.cellTypeHeader(false)); sheetTmp.setColumnWidth(i + 1, item.getColumnWidth()); sheetTmp.setColumnHidden(i + 1, item.getColumnHiden()); if (item.getHeaderCommand() != null) { cell.setCellComment(getcellComment(sheetTmp, item, cell)); } setFormatCell(customCellType, item); } if (DataUtil.isListNullOrEmpty(formatExcell) || DataUtil.isListNullOrEmpty(lstData)) { return; } buildContentSheet(sheetTmp, customCellType, lstData, formatExcell); }
From source file:com.dituiba.excel.DefaultValidateAdapter.java
License:Apache License
/** * ???//from ww w. j av a2s. com * @param dataBean * @param sheet * @param columnIndex * @param filedName */ public void HiddenValidateAdapter(DataBean dataBean, Sheet sheet, int columnIndex, String filedName) { sheet.setColumnHidden(columnIndex, true); }
From source file:com.globalsight.everest.qachecks.DITAQAChecker.java
License:Apache License
/** * Add hidden info "DITA_taskID" for offline uploading. When upload, system * can know the report type and current task ID report generated from. *///from w ww .j a va 2s.c o m private void addHidenInfoForUpload(Workbook p_workbook, Sheet p_sheet, long p_taskId) throws Exception { Row titleRow = getRow(p_sheet, 0); Cell cell_AA1 = getCell(titleRow, 26); cell_AA1.setCellValue("DITA_" + p_taskId); cell_AA1.setCellStyle(contentStyle); p_sheet.setColumnHidden(26, true); }
From source file:com.globalsight.everest.qachecks.QAChecker.java
License:Apache License
private void addHiddenInfoForUpload(Workbook p_workbook, Sheet p_sheet, long p_taskId) { int hiddenColumn = COLUMN_HIDDEN_INFO; String hiddenValue = ReportConstants.PREFIX_QA_CHECKS_REPORT + "_" + p_taskId; Row titleRow = getRow(p_sheet, 0);/*from w ww . j a va 2 s . c o m*/ Cell hiddenCell = getCell(titleRow, hiddenColumn); hiddenCell.setCellValue(hiddenValue); hiddenCell.setCellStyle(getContentStyle(p_workbook)); p_sheet.setColumnHidden(hiddenColumn, true); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java
License:Apache License
/** * Create workbook name areas for category failure drop down list, it is * from "AA8" to "AAn".//from ww w .ja v a 2s . co m * <P> * Only write the data of drop down list into the first sheet as it can be * referenced from all sheets. * </P> * <P> * The formula is like * "[sheetName]!$AA$[startRow]:$AA$[endRow]",i.e."TER!$AA$8:$AA$32". * </P> */ private void createCategoryFailureNameArea(Workbook p_workbook) { try { Sheet firstSheet = getSheet(p_workbook, 0); List<String> categories = getFailureCategoriesList(); // Set the categories in "AA" column, starts with row 8. int col = 26; for (int i = 0; i < categories.size(); i++) { Row row = getRow(firstSheet, SEGMENT_START_ROW + i); Cell cell = getCell(row, col); cell.setCellValue(categories.get(i)); } String formula = firstSheet.getSheetName() + "!$AA$" + (SEGMENT_START_ROW + 1) + ":$AA$" + (SEGMENT_START_ROW + categories.size()); Name name = p_workbook.createName(); name.setRefersToFormula(formula); name.setNameName(CATEGORY_FAILURE_DROP_DOWN_LIST); // Hide "AA" column firstSheet.setColumnHidden(26, true); } catch (Exception e) { logger.error("Error when create hidden area for category failures.", e); } }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.PostReviewQAReportGenerator.java
License:Apache License
/** * Add hidden info "TER_taskID" for offline uploading. When upload, system * can know the report type and current task ID report generated from. * //from w ww . j a v a 2s.c o m * @param p_workbook * @param p_sheet * @param p_job * @param p_targetLocale * @throws Exception */ private void addHidenInfoForUpload(Workbook p_workbook, Sheet p_sheet, Job p_job, GlobalSightLocale p_targetLocale) throws Exception { String reportInfo = ""; for (Workflow wf : p_job.getWorkflows()) { if (p_targetLocale.getId() == wf.getTargetLocale().getId()) { Collection tasks = ServerProxy.getTaskManager().getCurrentTasks(wf.getId()); if (tasks != null) { for (Iterator it = tasks.iterator(); it.hasNext();) { Task task = (Task) it.next(); reportInfo = ReportConstants.POST_REVIEW_REPORT_ABBREVIATION + "_" + task.getId(); } } } } Row titleRow = getRow(p_sheet, 0); Cell taskIdCell = getCell(titleRow, 26); taskIdCell.setCellValue(reportInfo); taskIdCell.setCellStyle(contentStyle); p_sheet.setColumnHidden(26, true); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.PostReviewQAReportGenerator.java
License:Apache License
/** * Create workbook name areas for category failure drop down list, it is * from "AA8" to "AAn".//from w ww. j a v a2 s . c om * <P> * Only write the data of drop down list into the first sheet as it can be * referenced from all sheets. * </P> * <P> * The formula is like * "[sheetName]!$AA$[startRow]:$AA$[endRow]",i.e."TER!$AA$8:$AA$32". * </P> */ private void createCategoryFailureNameArea(Workbook p_workbook) { try { // Ensure the name area is written only one time,otherwise it has // problem when open generated excel file. if (p_workbook.getNumberOfSheets() == 1) { Sheet firstSheet = getSheet(p_workbook, 0); List<String> categories = getFailureCategoriesList(); // Set the categories in "AA" column, starts with row 8. int col = 26; for (int i = 0; i < categories.size(); i++) { Row row = getRow(firstSheet, SEGMENT_START_ROW + i); Cell cell = getCell(row, col); cell.setCellValue(categories.get(i)); } String formula = firstSheet.getSheetName() + "!$AA$" + (SEGMENT_START_ROW + 1) + ":$AA$" + (SEGMENT_START_ROW + categories.size()); Name name = p_workbook.createName(); name.setRefersToFormula(formula); name.setNameName(CATEGORY_FAILURE_DROP_DOWN_LIST); // Hide "AA" column firstSheet.setColumnHidden(26, true); } } catch (Exception e) { logger.error("Error when create hidden area for category failures.", e); } }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.PostReviewQAReportGenerator.java
License:Apache License
private void createQualityAssessmentNameArea(Workbook p_workbook) { try {/*from w w w.j a v a2s .co m*/ // Ensure the name area is written only one time,otherwise it has // problem when open generated excel file. if (p_workbook.getNumberOfSheets() == 1) { Sheet firstSheet = getSheet(p_workbook, 0); List<String> qualityCategories = getQualityAssessmentList(); // Set the categories in "AA" column, starts with row 8. int col = 27; for (int i = 0; i < qualityCategories.size(); i++) { Row row = getRow(firstSheet, SEGMENT_START_ROW + i); Cell cell = getCell(row, col); cell.setCellValue(qualityCategories.get(i)); } String formula = firstSheet.getSheetName() + "!$AB$" + (SEGMENT_START_ROW + 1) + ":$AB$" + (SEGMENT_START_ROW + qualityCategories.size()); Name name = p_workbook.createName(); name.setRefersToFormula(formula); name.setNameName(QUALITY_ASSESSMENT_LIST); // Hide "AB" column firstSheet.setColumnHidden(27, true); } } catch (Exception e) { logger.error("Error when create hidden area for category failures.", e); } }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.PostReviewQAReportGenerator.java
License:Apache License
private void createMarketSuitabilityNameArea(Workbook p_workbook) { try {/*from w w w . j av a 2 s . com*/ // Ensure the name area is written only one time,otherwise it has // problem when open generated excel file. if (p_workbook.getNumberOfSheets() == 1) { Sheet firstSheet = getSheet(p_workbook, 0); List<String> marketCategories = getMarketSuitabilityList(); // Set the categories in "AC" column, starts with row 11. int col = 28; for (int i = 0; i < marketCategories.size(); i++) { Row row = getRow(firstSheet, SEGMENT_START_ROW + i); Cell cell = getCell(row, col); cell.setCellValue(marketCategories.get(i)); } String formula = firstSheet.getSheetName() + "!$AC$" + (SEGMENT_START_ROW + 1) + ":$AC$" + (SEGMENT_START_ROW + marketCategories.size()); Name name = p_workbook.createName(); name.setRefersToFormula(formula); name.setNameName(MARKET_SUITABILITY_LIST); // Hide "AC" column firstSheet.setColumnHidden(28, true); } } catch (Exception e) { logger.error("Error when create hidden area for category failures.", e); } }