Java Code Examples for org.jeecgframework.poi.excel.annotation.ExcelTarget#value()
The following examples show how to use
org.jeecgframework.poi.excel.annotation.ExcelTarget#value() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExcelExportOfTemplateUtil.java From autopoi with Apache License 2.0 | 5 votes |
/** * 往Sheet 填充正常数据,根据表头信息 使用导入的部分逻辑,坐对象映射 * * @param teplateParams * @param pojoClass * @param dataSet * @param workbook */ private void addDataToSheet(Class<?> pojoClass, Collection<?> dataSet, Sheet sheet, Workbook workbook) throws Exception { if (workbook instanceof XSSFWorkbook) { super.type = ExcelType.XSSF; } // 获取表头数据 Map<String, Integer> titlemap = getTitleMap(sheet); Drawing patriarch = sheet.createDrawingPatriarch(); // 得到所有字段 Field[] fileds = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); String targetId = null; if (etarget != null) { targetId = etarget.value(); } // 获取实体对象的导出数据 List<ExcelExportEntity> excelParams = new ArrayList<ExcelExportEntity>(); getAllExcelField(null, targetId, fileds, excelParams, pojoClass, null); // 根据表头进行筛选排序 sortAndFilterExportField(excelParams, titlemap); short rowHeight = getRowHeight(excelParams); int index = teplateParams.getHeadingRows() + teplateParams.getHeadingStartRow(), titleHeight = index; // 下移数据,模拟插入 sheet.shiftRows(teplateParams.getHeadingRows() + teplateParams.getHeadingStartRow(), sheet.getLastRowNum(), getShiftRows(dataSet, excelParams), true, true); if (excelParams.size() == 0) { return; } Iterator<?> its = dataSet.iterator(); while (its.hasNext()) { Object t = its.next(); index += createCells(patriarch, index, t, excelParams, sheet, workbook, rowHeight); } // 合并同类项 mergeCells(sheet, excelParams, titleHeight); }
Example 2
Source File: SaxRowRead.java From autopoi with Apache License 2.0 | 5 votes |
private void initParams(Class<?> pojoClass, ImportParams params) { try { Field fileds[] = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); if (etarget != null) { targetId = etarget.value(); } getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example 3
Source File: ExcelEntityParse.java From autopoi with Apache License 2.0 | 5 votes |
/** * 解析上一行并生成更多行 * * @param table * @param i * @param listobj */ public void parseNextRowAndAddRow(XWPFTable table, int index, ExcelListEntity entity) { checkExcelParams(entity); // 获取表头数据 Map<String, Integer> titlemap = getTitleMap(table, index, entity.getHeadRows()); try { // 得到所有字段 Field fileds[] = PoiPublicUtil.getClassFields(entity.getClazz()); ExcelTarget etarget = entity.getClazz().getAnnotation(ExcelTarget.class); String targetId = null; if (etarget != null) { targetId = etarget.value(); } // 获取实体对象的导出数据 List<ExcelExportEntity> excelParams = new ArrayList<ExcelExportEntity>(); getAllExcelField(null, targetId, fileds, excelParams, entity.getClazz(), null); // 根据表头进行筛选排序 sortAndFilterExportField(excelParams, titlemap); short rowHeight = getRowHeight(excelParams); Iterator<?> its = entity.getList().iterator(); while (its.hasNext()) { Object t = its.next(); index += createCells(index, t, excelParams, table, rowHeight); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }
Example 4
Source File: ExcelExportOfTemplateUtil.java From jeasypoi with Apache License 2.0 | 5 votes |
/** * 往Sheet 填充正常数据,根据表头信息 使用导入的部分逻辑,坐对象映射 * * @param teplateParams * @param pojoClass * @param dataSet * @param workbook */ private void addDataToSheet(Class<?> pojoClass, Collection<?> dataSet, Sheet sheet, Workbook workbook) throws Exception { if (workbook instanceof XSSFWorkbook) { super.type = ExcelType.XSSF; } // 获取表头数据 Map<String, Integer> titlemap = getTitleMap(sheet); Drawing patriarch = sheet.createDrawingPatriarch(); // 得到所有字段 Field[] fileds = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); String targetId = null; if (etarget != null) { targetId = etarget.value(); } // 获取实体对象的导出数据 List<ExcelExportEntity> excelParams = new ArrayList<ExcelExportEntity>(); getAllExcelField(null, targetId, fileds, excelParams, pojoClass, null); // 根据表头进行筛选排序 sortAndFilterExportField(excelParams, titlemap); short rowHeight = getRowHeight(excelParams); int index = teplateParams.getHeadingRows() + teplateParams.getHeadingStartRow(), titleHeight = index; // 下移数据,模拟插入 sheet.shiftRows(teplateParams.getHeadingRows() + teplateParams.getHeadingStartRow(), sheet.getLastRowNum(), getShiftRows(dataSet, excelParams), true, true); if (excelParams.size() == 0) { return; } Iterator<?> its = dataSet.iterator(); while (its.hasNext()) { Object t = its.next(); index += createCells(patriarch, index, t, excelParams, sheet, workbook, rowHeight); } // 合并同类项 mergeCells(sheet, excelParams, titleHeight); }
Example 5
Source File: SaxRowRead.java From jeasypoi with Apache License 2.0 | 5 votes |
private void initParams(Class<?> pojoClass, ImportParams params) { try { Field fileds[] = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); if (etarget != null) { targetId = etarget.value(); } getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example 6
Source File: ExcelEntityParse.java From jeasypoi with Apache License 2.0 | 5 votes |
/** * 解析上一行并生成更多行 * * @param table * @param i * @param listobj */ public void parseNextRowAndAddRow(XWPFTable table, int index, ExcelListEntity entity) { checkExcelParams(entity); // 获取表头数据 Map<String, Integer> titlemap = getTitleMap(table, index, entity.getHeadRows()); try { // 得到所有字段 Field fileds[] = PoiPublicUtil.getClassFields(entity.getClazz()); ExcelTarget etarget = entity.getClazz().getAnnotation(ExcelTarget.class); String targetId = null; if (etarget != null) { targetId = etarget.value(); } // 获取实体对象的导出数据 List<ExcelExportEntity> excelParams = new ArrayList<ExcelExportEntity>(); getAllExcelField(null, targetId, fileds, excelParams, entity.getClazz(), null); // 根据表头进行筛选排序 sortAndFilterExportField(excelParams, titlemap); short rowHeight = getRowHeight(excelParams); Iterator<?> its = entity.getList().iterator(); while (its.hasNext()) { Object t = its.next(); index += createCells(index, t, excelParams, table, rowHeight); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }
Example 7
Source File: ExcelExportOfTemplateUtil.java From easypoi with Apache License 2.0 | 5 votes |
/** * 往Sheet 填充正常数据,根据表头信息 使用导入的部分逻辑,坐对象映射 * * @param teplateParams * @param pojoClass * @param dataSet * @param workbook */ private void addDataToSheet(Class<?> pojoClass, Collection<?> dataSet, Sheet sheet, Workbook workbook) throws Exception { if (workbook instanceof XSSFWorkbook) { super.type = ExcelType.XSSF; } // 获取表头数据 Map<String, Integer> titlemap = getTitleMap(sheet); Drawing patriarch = sheet.createDrawingPatriarch(); // 得到所有字段 Field[] fileds = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); String targetId = null; if (etarget != null) { targetId = etarget.value(); } // 获取实体对象的导出数据 List<ExcelExportEntity> excelParams = new ArrayList<ExcelExportEntity>(); getAllExcelField(null, targetId, fileds, excelParams, pojoClass, null); // 根据表头进行筛选排序 sortAndFilterExportField(excelParams, titlemap); short rowHeight = getRowHeight(excelParams); int index = teplateParams.getHeadingRows() + teplateParams.getHeadingStartRow(), titleHeight = index; //下移数据,模拟插入 sheet.shiftRows(teplateParams.getHeadingRows() + teplateParams.getHeadingStartRow(), sheet.getLastRowNum(), getShiftRows(dataSet, excelParams), true, true); if (excelParams.size() == 0) { return; } Iterator<?> its = dataSet.iterator(); while (its.hasNext()) { Object t = its.next(); index += createCells(patriarch, index, t, excelParams, sheet, workbook, rowHeight); } // 合并同类项 mergeCells(sheet, excelParams, titleHeight); }
Example 8
Source File: SaxRowRead.java From easypoi with Apache License 2.0 | 5 votes |
private void initParams(Class<?> pojoClass, ImportParams params) { try { Field fileds[] = PoiPublicUtil.getClassFields(pojoClass); ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class); if (etarget != null) { targetId = etarget.value(); } getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new ExcelImportException(e.getMessage()); } }
Example 9
Source File: ExcelEntityParse.java From easypoi with Apache License 2.0 | 5 votes |
/** * 解析上一行并生成更多行 * * @param table * @param i * @param listobj */ public void parseNextRowAndAddRow(XWPFTable table, int index, ExcelListEntity entity) { checkExcelParams(entity); // 获取表头数据 Map<String, Integer> titlemap = getTitleMap(table, index, entity.getHeadRows()); try { // 得到所有字段 Field fileds[] = PoiPublicUtil.getClassFields(entity.getClazz()); ExcelTarget etarget = entity.getClazz().getAnnotation(ExcelTarget.class); String targetId = null; if (etarget != null) { targetId = etarget.value(); } // 获取实体对象的导出数据 List<ExcelExportEntity> excelParams = new ArrayList<ExcelExportEntity>(); getAllExcelField(null, targetId, fileds, excelParams, entity.getClazz(), null); // 根据表头进行筛选排序 sortAndFilterExportField(excelParams, titlemap); short rowHeight = getRowHeight(excelParams); Iterator<?> its = entity.getList().iterator(); while (its.hasNext()) { Object t = its.next(); index += createCells(index, t, excelParams, table, rowHeight); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }