- 浏览: 284051 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
北方狼:
请问,当表格列数过多时,除了调整pdf页面宽度,能否设置分页显 ...
利用itext操作pdf从数据库导出大量数据--功能汇总(一) -
15817048604:
.....................
利用itext操作pdf从数据库导出大量数据--添加水印(四) -
laoma102:
顶个,谢楼主
代理模式,JDK动态代理,SpringAOP来龙去脉 -
穷途末路:
给力,谢谢分享
Excel2003和Excel2007对下拉选择和下拉级联选择的操作以及java程序的调用 -
weir2009:
复杂的交叉表crosstab 怎么处理?
利用itext操作pdf从数据库导出大量数据--功能汇总(一)
PIO的EXCEL的字体样式,边框样式,背景色样式,下拉选择,下拉级联选择,日期格式验证,下拉验证,验证错误提示,输入信息提示等功能
代码如下
代码如下
package com.fruitking.excel; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.Workbook; public class ExcelCreateMain { /** * @param args */ public static void main(String[] args) throws IOException{ Workbook wb = ExcelCreateUtil.createTemplateWorkbook(); ExcelHidePageUtil.creatExcelHidePage(wb); ExcelCreateUtil.setDataValidation(wb); // Write the output to a file FileOutputStream fileOut = new FileOutputStream("student_template.xls"); wb.write(fileOut); fileOut.close(); } }
package com.fruitking.excel; import org.apache.poi.hssf.usermodel.DVConstraint; import org.apache.poi.hssf.usermodel.HSSFDataValidation; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.DataValidation; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellRangeAddressList; public class ExcelCreateUtil { /** * 创建一个预定义格式的模板文件的工作薄 * @return */ public static Workbook createTemplateWorkbook(){ Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet("学生信息表-1"); // Create a row and put some cells in it. Rows are 0 based. Row row = sheet.createRow(0); Cell cell = row.createCell(0); cell.setCellValue(ExcelParameter.TITLE_STUDENT_NO); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(1); cell.setCellValue(ExcelParameter.TITLE_STUDENT_NAME); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(2); cell.setCellValue(ExcelParameter.TITLE_STUDENT_SEX); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(3); cell.setCellValue(ExcelParameter.TITLE_STUDENT_AGE); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(4); cell.setCellValue(ExcelParameter.TITLE_BIRTHDAY); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(5); cell.setCellValue(ExcelParameter.TITLE_PROVINCE_NAME); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(6); cell.setCellValue(ExcelParameter.TITLE_CITY_NAME); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(7); cell.setCellValue(ExcelParameter.TITLE_COLLAGE_NAME); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(8); cell.setCellValue(ExcelParameter.TITLE_MAJOR_NAME); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); cell = row.createCell(9); cell.setCellValue(ExcelParameter.TITLE_REMARK); cell.setCellStyle(ExcelCreateUtil.getTitleStyle(wb)); row = sheet.createRow(1); cell = row.createCell(0); cell.setCellValue("12009007001"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(1); cell.setCellValue("许果"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(2); cell.setCellValue("男"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(3); cell.setCellValue("28"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(4); cell.setCellValue("2010-11-23"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(5); cell.setCellValue("四川"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(6); cell.setCellValue("巴中"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(7); cell.setCellValue("四川理工学院"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(8); cell.setCellValue("计算机科学与技术专业"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); cell = row.createCell(9); cell.setCellValue("此人喜欢美女"); cell.setCellStyle(ExcelCreateUtil.getValueStyle(wb)); sheet.autoSizeColumn(0); sheet.autoSizeColumn(1); sheet.autoSizeColumn(2); sheet.autoSizeColumn(3); sheet.autoSizeColumn(4); sheet.autoSizeColumn(5); sheet.autoSizeColumn(6); sheet.autoSizeColumn(7); sheet.autoSizeColumn(8); sheet.autoSizeColumn(9); return wb; } /** * 添加数据验证选项 * @param sheet */ public static void setDataValidation(Workbook wb){ int sheetIndex = wb.getNumberOfSheets(); if(sheetIndex>0){ for(int i=0;i<sheetIndex;i++){ Sheet sheet = wb.getSheetAt(i); if(!ExcelParameter.EXCEL_HIDE_SHEET_NAME.equals(sheet.getSheetName())){ //省份选项添加验证数据 DataValidation data_validation_list = ExcelCreateUtil.getDataValidationByFormula(ExcelParameter.HIDE_SHEET_NAME_PROVINCE,2,6); sheet.addValidationData(data_validation_list); //城市选项添加验证数据 data_validation_list = ExcelCreateUtil.getDataValidationByFormula("INDIRECT(F2)",2,7); sheet.addValidationData(data_validation_list); //性别添加验证数据 data_validation_list = ExcelCreateUtil.getDataValidationByFormula(ExcelParameter.HIDE_SHEET_NAME_SEX,2,3); sheet.addValidationData(data_validation_list); //有效时间项的格式验证 data_validation_list = ExcelCreateUtil.getDataValidationByDate(2,5); sheet.addValidationData(data_validation_list); } } } } /** * 设置模板文件的横向表头单元格的样式 * @param wb * @return */ private static CellStyle getTitleStyle(Workbook wb){ CellStyle style = wb.createCellStyle(); //对齐方式设置 style.setAlignment(CellStyle.ALIGN_CENTER); //边框颜色和宽度设置 style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setFillBackgroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); //设置背景颜色 style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); //粗体字设置 Font font = wb.createFont(); font.setBoldweight(Font.BOLDWEIGHT_BOLD); style.setFont(font); return style; } /** * 设置模板文件的输入项表格样式 * @param wb * @return */ private static CellStyle getValueStyle(Workbook wb){ CellStyle style = wb.createCellStyle(); //对齐方式设置 style.setAlignment(CellStyle.ALIGN_LEFT); //边框颜色和宽度设置 style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BROWN.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.BROWN.getIndex()); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BROWN.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BROWN.getIndex()); return style; } /** * 使用已定义的数据源方式设置一个数据验证 * @param formulaString * @param naturalRowIndex * @param naturalColumnIndex * @return */ private static DataValidation getDataValidationByFormula(String formulaString,int naturalRowIndex,int naturalColumnIndex){ //加载下拉列表内容 DVConstraint constraint = DVConstraint.createFormulaListConstraint(formulaString); //设置数据有效性加载在哪个单元格上。 //四个参数分别是:起始行、终止行、起始列、终止列 int firstRow = naturalRowIndex-1; int lastRow = naturalRowIndex-1; int firstCol = naturalColumnIndex-1; int lastCol = naturalColumnIndex-1; CellRangeAddressList regions=new CellRangeAddressList(firstRow,lastRow,firstCol,lastCol); //数据有效性对象 DataValidation data_validation_list = new HSSFDataValidation(regions,constraint); //设置输入信息提示信息 data_validation_list.createPromptBox("下拉选择提示","请使用下拉方式选择合适的值!"); //设置输入错误提示信息 data_validation_list.createErrorBox("选择错误提示","你输入的值未在备选列表中,请下拉选择合适的值!"); return data_validation_list; } private static DataValidation getDataValidationByDate(int naturalRowIndex,int naturalColumnIndex){ //加载下拉列表内容 DVConstraint constraint = DVConstraint.createDateConstraint(DVConstraint.OperatorType.BETWEEN,"1900-01-01", "5000-01-01", "yyyy-mm-dd"); //设置数据有效性加载在哪个单元格上。 //四个参数分别是:起始行、终止行、起始列、终止列 int firstRow = naturalRowIndex-1; int lastRow = naturalRowIndex-1; int firstCol = naturalColumnIndex-1; int lastCol = naturalColumnIndex-1; CellRangeAddressList regions=new CellRangeAddressList(firstRow,lastRow,firstCol,lastCol); //数据有效性对象 DataValidation data_validation_list = new HSSFDataValidation(regions,constraint); //设置输入信息提示信息 data_validation_list.createPromptBox("日期格式提示","请按照'yyyy-mm-dd'格式输入日期值!"); //设置输入错误提示信息 data_validation_list.createErrorBox("日期格式错误提示","你输入的日期格式不符合'yyyy-mm-dd'格式规范,请重新输入!"); return data_validation_list; } }
package com.fruitking.excel; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Name; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; public class ExcelHidePageUtil { /** * 创建一个隐藏页和隐藏数据集 * @param workbook */ public static void creatExcelHidePage(Workbook workbook){ Sheet hideInfoSheet = workbook.createSheet(ExcelParameter.EXCEL_HIDE_SHEET_NAME);//隐藏一些信息 //在隐藏页设置选择信息 //第一行设置性别信息 Row sexRow = hideInfoSheet.createRow(0); ExcelHidePageUtil.creatRow(sexRow, ExcelParameter.sexList); //第二行设置省份名称列表 Row provinceNameRow = hideInfoSheet.createRow(1); ExcelHidePageUtil.creatRow(provinceNameRow, ExcelParameter.provinceList); //一下行设置城市名称列表 Row cityNameRow = hideInfoSheet.createRow(2); ExcelHidePageUtil.creatRow(cityNameRow, ExcelParameter.zjProvinceList); cityNameRow = hideInfoSheet.createRow(3); ExcelHidePageUtil.creatRow(cityNameRow, ExcelParameter.sdProvinceList); cityNameRow = hideInfoSheet.createRow(4); ExcelHidePageUtil.creatRow(cityNameRow, ExcelParameter.jxProvinceList); cityNameRow = hideInfoSheet.createRow(5); ExcelHidePageUtil.creatRow(cityNameRow, ExcelParameter.jsProvinceList); cityNameRow = hideInfoSheet.createRow(6); ExcelHidePageUtil.creatRow(cityNameRow, ExcelParameter.scProvinceList); //名称管理 //第一行设置性别信息 ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.HIDE_SHEET_NAME_SEX, 1, ExcelParameter.sexList.length, false); //第二行设置省份名称列表 ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.HIDE_SHEET_NAME_PROVINCE, 2, ExcelParameter.provinceList.length, false); //以后动态大小设置省份对应的城市列表 ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.provinceList[0], 3, ExcelParameter.zjProvinceList.length, true); ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.provinceList[1], 4, ExcelParameter.sdProvinceList.length, true); ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.provinceList[2], 5, ExcelParameter.jxProvinceList.length, true); ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.provinceList[3], 6, ExcelParameter.jsProvinceList.length, true); ExcelHidePageUtil.creatExcelNameList(workbook, ExcelParameter.provinceList[4], 7, ExcelParameter.scProvinceList.length, true); //设置隐藏页标志 workbook.setSheetHidden(workbook.getSheetIndex(ExcelParameter.EXCEL_HIDE_SHEET_NAME), true); } /** * 创建一个名称 * @param workbook */ private static void creatExcelNameList(Workbook workbook,String nameCode,int order,int size,boolean cascadeFlag){ Name name; name = workbook.createName(); name.setNameName(nameCode); name.setRefersToFormula(ExcelParameter.EXCEL_HIDE_SHEET_NAME+"!"+ExcelHidePageUtil.creatExcelNameList(order,size,cascadeFlag)); } /** * 名称数据行列计算表达式 * @param workbook */ private static String creatExcelNameList(int order,int size,boolean cascadeFlag){ char start = 'A'; if(cascadeFlag){ start = 'B'; if(size<=25){ char end = (char)(start+size-1); return "$"+start+"$"+order+":$"+end+"$"+order; }else{ char endPrefix = 'A'; char endSuffix = 'A'; if((size-25)/26==0||size==51){//26-51之间,包括边界(仅两次字母表计算) if((size-25)%26==0){//边界值 endSuffix = (char)('A'+25); }else{ endSuffix = (char)('A'+(size-25)%26-1); } }else{//51以上 if((size-25)%26==0){ endSuffix = (char)('A'+25); endPrefix = (char)(endPrefix + (size-25)/26 - 1); }else{ endSuffix = (char)('A'+(size-25)%26-1); endPrefix = (char)(endPrefix + (size-25)/26); } } return "$"+start+"$"+order+":$"+endPrefix+endSuffix+"$"+order; } }else{ if(size<=26){ char end = (char)(start+size-1); return "$"+start+"$"+order+":$"+end+"$"+order; }else{ char endPrefix = 'A'; char endSuffix = 'A'; if(size%26==0){ endSuffix = (char)('A'+25); if(size>52&&size/26>0){ endPrefix = (char)(endPrefix + size/26-2); } }else{ endSuffix = (char)('A'+size%26-1); if(size>52&&size/26>0){ endPrefix = (char)(endPrefix + size/26-1); } } return "$"+start+"$"+order+":$"+endPrefix+endSuffix+"$"+order; } } } /** * 创建一列数据 * @param currentRow * @param textList */ private static void creatRow(Row currentRow,String[] textList){ if(textList!=null&&textList.length>0){ int i = 0; for(String cellValue : textList){ Cell userNameLableCell = currentRow.createCell(i++); userNameLableCell.setCellValue(cellValue); } } } /** * 创建一列数据 * @param currentRow * @param textList */ private static void creatRow(Row currentRow,String headerName,String[] textList){ if(headerName!=null){ Cell userNameLableCell = currentRow.createCell(0); userNameLableCell.setCellValue(headerName); } if(textList!=null&&textList.length>0){ int i = 1; for(String cellValue : textList){ Cell userNameLableCell = currentRow.createCell(i++); userNameLableCell.setCellValue(cellValue); } } } }
package com.fruitking.excel; public class ExcelParameter { public static String TITLE_STUDENT_NO = "学生学号"; public static String TITLE_STUDENT_NAME = "学生姓名"; public static String TITLE_STUDENT_SEX = "性别"; public static String TITLE_STUDENT_AGE = "年龄"; public static String TITLE_BIRTHDAY = "出生日期"; public static String TITLE_PROVINCE_NAME = "出生省份"; public static String TITLE_CITY_NAME = "出生城市"; public static String TITLE_COLLAGE_NAME = "所在学院"; public static String TITLE_MAJOR_NAME = "专业名称"; public static String TITLE_REMARK = "备注信息"; public static String EXCEL_HIDE_SHEET_NAME = "excelhidesheetname"; public static String HIDE_SHEET_NAME_SEX = "sexList"; public static String HIDE_SHEET_NAME_PROVINCE = "provinceList"; //设置下拉列表的内容 public static String[] sexList = {"男","女"}; public static String[] provinceList = {"浙江","山东","江西","江苏","四川"}; public static String[] zjProvinceList = {"浙江","杭州","宁波","温州","台州","绍兴","金华","湖州","丽水","衢州","舟山"}; public static String[] sdProvinceList = {"山东","济南","青岛","烟台","东营","菏泽","淄博","济宁","威海"}; public static String[] jxProvinceList = {"江西","南昌","新余","鹰潭","抚州"}; public static String[] jsProvinceList = {"江苏","南京","苏州","无锡","常州","南通","泰州","连云港","徐州"}; public static String[] scProvinceList = {"四川","成都","绵阳","自贡","泸州","宜宾","攀枝花","广安","达州","广元","遂宁"}; }
package com.fruitking.excel; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; public class ExcelParserUtil { /** * 解析规则包模板文件 * @param templateFileInputStream * @return * @throws IOException */ public static List<Student> parseTemplateFile(InputStream templateFileInputStream)throws IOException{ POIFSFileSystem pioFSFileSystem = new POIFSFileSystem(templateFileInputStream); Workbook workbook = new HSSFWorkbook(pioFSFileSystem); int sheetSize = workbook.getNumberOfSheets(); List<Student> studentList = new ArrayList<Student>(); if(sheetSize>0){ Student student = null; Sheet studentSheet = null; for(int i=0;i<sheetSize;i++){ studentSheet = workbook.getSheetAt(i); if(ExcelParameter.EXCEL_HIDE_SHEET_NAME.equals(studentSheet.getSheetName())){ continue; } student = ExcelParserUtil.getStudentBySheet(studentSheet); studentList.add(student); } } return studentList; } /** * 解析一个工作薄的信息 * @param studentSheet * @return */ private static Student getStudentBySheet(Sheet studentSheet){ Student student = new Student(); for (int i = studentSheet.getFirstRowNum(); i <= studentSheet.getLastRowNum(); i++) { Row row = studentSheet.getRow(i); if(i==0){ continue; } Cell cell = null; cell = row.getCell(0); student.setStudentNo(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(1); student.setStudentName(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(2); student.setStudentSex(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(3); student.setStudentAge(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(4); student.setBirthday(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(5); student.setProvinceName(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(6); student.setCityName(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(7); student.setCollageName(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(8); student.setMajorName(ExcelParserUtil.getCellValue(cell).trim()); cell = row.getCell(9); student.setRemark(ExcelParserUtil.getCellValue(cell).trim()); } return student; } /** * 获得单元格字符串值 * @param cell * @return */ private static String getCellValue(Cell cell){ switch (cell.getCellType()) { case Cell.CELL_TYPE_FORMULA: return cell.getCellFormula(); case Cell.CELL_TYPE_NUMERIC: return ""+(long)cell.getNumericCellValue(); case Cell.CELL_TYPE_STRING: return cell.getStringCellValue(); case Cell.CELL_TYPE_BOOLEAN: return ""+cell.getBooleanCellValue(); case Cell.CELL_TYPE_BLANK: return ""; default: return ""; } } }
package com.fruitking.excel; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; public class ExcelReaMain { /** * @param args */ public static void main(String[] args) throws IOException { InputStream inp = new FileInputStream("student_template.xls"); print(ExcelParserUtil.parseTemplateFile(inp)); inp.close(); } /** * 控制台打印一个工作台解析信息 * @param studentList */ public static void print(List<Student> studentList){ if(studentList!=null&&!studentList.isEmpty()){ for(Student student:studentList){ System.out.print(student.getStudentNo()); System.out.print(" ----- "); System.out.print(student.getStudentName()); System.out.print(" ----- "); System.out.print(student.getStudentSex()); System.out.print(" ----- "); System.out.print(student.getStudentAge()); System.out.print(" ----- "); System.out.print(student.getBirthday()); System.out.print(" ----- "); System.out.print(student.getProvinceName()); System.out.print(" ----- "); System.out.print(student.getCityName()); System.out.print(" ----- "); System.out.print(student.getCollageName()); System.out.print(" ----- "); System.out.print(student.getMajorName()); System.out.print(" ----- "); System.out.println(student.getRemark()); } } } }
package com.fruitking.excel; public class Student { private String studentNo;//学生学号 private String studentName;//学生姓名 private String studentSex;//性别 private String provinceName;//出生省份 private String cityName;//出生城市 private String collageName;//所在学院 private String majorName;//专业名称 private String studentAge ;//年龄 private String birthday;//出生日期 private String remark;//备注信息 public String getStudentNo() { return studentNo; } public void setStudentNo(String studentNo) { this.studentNo = studentNo; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public String getStudentSex() { return studentSex; } public void setStudentSex(String studentSex) { this.studentSex = studentSex; } public String getProvinceName() { return provinceName; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public String getCollageName() { return collageName; } public void setCollageName(String collageName) { this.collageName = collageName; } public String getMajorName() { return majorName; } public void setMajorName(String majorName) { this.majorName = majorName; } public String getStudentAge() { return studentAge; } public void setStudentAge(String studentAge) { this.studentAge = studentAge; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
- com.rar (7.3 KB)
- 下载次数: 38
发表评论
-
利用itext操作pdf从数据库导出大量数据--功能汇总(一)
2013-10-21 00:25 15775【原始需求】 通过SQL及JDBC模式导出各类业务数据,以PD ... -
利用itext操作pdf从数据库导出大量数据--添加水印(四)
2013-10-21 00:16 4236【原始需求】 通过SQL及JDBC模式导出各类业务数据,以PD ... -
利用itext操作pdf从数据库导出大量数据--创建PDF表格(三)
2013-10-21 00:14 10180【原始需求】 通过SQL及JDBC模式导出各类业务数据,以PD ... -
利用itext操作pdf从数据库导出大量数据--创建PDF相关(二)
2013-10-21 00:12 4663【原始需求】 通过SQL及JDBC模式导出各类业务数据,以PD ... -
利用itext操作pdf从数据库导出大量数据--汇总(一)
2013-10-21 00:06 0【原始需求】 通过SQL及JDBC模式导出各类业务数据,以PD ... -
kettle应用程序集成代码
2013-06-19 21:32 1827package com.zjhcsoft.kettle.t ... -
转载:hibernate原理及应用知识点
2011-10-22 12:45 2044SSH面试题总结 ... -
上传一个ssh整个的工程,方便搭建基于spring的web应用
2010-12-07 20:36 1086web有struts2,spring hibernate组件 ... -
上一篇的flex的远程对象调用,flex和spring集成分页的jar和截图
2010-06-04 22:18 1480需要的jar如附件 返回结果不需要设定特别的java对象和ac ... -
flex远程对象调用,flex和spring的集成,分页
2010-06-04 21:58 2476这里讲解四个例子 1,使用flex的远程调用方式(java的B ... -
j2ee概念规范结构学习
2010-01-11 11:19 1235J2EE规范:就是把把一系 ... -
Jboss下开发ejb应用之一消息驱动bean的应用
2010-01-06 17:28 1923Jboss下开发ejb应用之一消息驱动bean的应用,这是一篇 ... -
Jboss下开发ejb应用之一实体bean的应用
2010-01-05 16:26 1366Jboss下开发ejb应用之一 ... -
Jboss下开发ejb应用之一会话bean的应用
2010-01-05 11:57 1419Jboss下开发ejb应用之一 ... -
根据dhlayer整理的输入提示下拉列表信息
2009-09-24 11:26 1265根据dhlayer整理的输入提示下拉列表信息 这里用的是网络下 ... -
log4j的项目引用
2008-08-06 08:51 1205最近写了一个利用log4j记录方法调用信息(方法名 时间 ... -
freemarker 中的is undefined错误
2008-08-05 16:36 2143freemarker 中的is undefined错误一般都是 ... -
jasperreport报表的使用
2008-06-10 14:24 14281. 下载ireport和jasperreport。不知道就b ... -
使用dwr错误总结
2008-05-26 19:19 17081.是否在spring容器中创建了bean 2.是否在dwr. ... -
开源组件的使用总结之二
2008-05-18 13:10 1156web service 不同项目 不同系统 不同物理位置的 ...
相关推荐
使用Java POI,可以将图片导出到Excel中,这需要使用到Drawings类和Picture类。首先,需要创建一个Drawings对象,然后使用Drawings对象的addPicture方法将图片添加到Excel中。 3. 使用Java POI下载Excel文件 在示例...
Java导出Excel是Java开发中常见的需求,尤其是在数据处理和报表生成方面。Apache POI库是Java领域中广泛使用的工具,它允许开发者读写Microsoft Office格式的文件,包括Excel(.xlsx和.xls)。本篇文章将深入讲解...
### POI的EXCEL导出,自动换行 在日常工作中,经常需要处理大量的数据导入导出任务,尤其是在企业级应用开发中,Excel文件的处理成为了一项必不可少的能力。Apache POI项目提供了一系列用于读写Microsoft Office...
4. 保存和导出:完成数据填充和合并后,调用`Workbook`对象的`write()`方法将工作簿写入到输出流,然后可以提供给用户下载。 在描述中提到的“支持纵向合并单元格(合并重复内容)”可能是指在数据填充时,如果相邻...
在Java编程环境中,Apache POI库是一个非常重要的工具,它允许开发者读取、写入以及修改Microsoft Office格式的文件,尤其是Excel(.xlsx 和 .xls)文件。标题"poi导入导出excel所需jar"和描述"java 使用poi导入导出...
【描述】中提到的“PIO万能转换”可能是指Apache POI项目,这是一个流行的开源库,用于读写Microsoft Office格式的文件,包括Excel(XLS和XLSX)。Apache POI提供了丰富的API,使得开发者能够使用Java处理Excel文件...
在批量导入导出过程中,POI允许程序创建、修改和保存Excel文件,包括设置工作表、单元格的各种属性。例如,可以创建新的工作簿,添加工作表,设定单元格的值,设置单元格样式,甚至处理公式和图表。这使得Java应用...
在这个"poi导入excel的demo"中,我们将深入探讨如何使用Apache POI库来读取和写入Excel文件,支持.xls(BIFF8格式)和.xlsx(OOXML格式)这两种常见的Excel版本。 1. **Apache POI简介** Apache POI 是Java平台上...
2. **导出Excel数据**:同样,如果你有数据库中的数据需要导出到Excel,你可以遍历数据并创建相应的行和单元格。例如,从MySQL数据库获取数据后,你可以将其写入Excel: ```java PreparedStatement pstmt = ...
Java POI 是一个开源项目,专门用于处理Microsoft Office格式的文件,如Excel、Word和PowerPoint。在Java世界中,如果你需要对Excel进行操作,比如读取、写入或者修改数据,Java POI是一个非常重要的工具。这个"java...
【标题】:“poi相关架包”指的是Apache POI项目中的必备库文件,这些库使得开发者能够在Java环境中读取、写入以及操作Microsoft Office格式的文件,如Excel、Word和PowerPoint。 【描述】:Apache POI是一个开源...
1. **核心功能**:Apache POI的主要功能包括读取和写入Excel(XLS和XLSX)、Word(DOC和DOCX)以及PowerPoint(PPT和PPTX)文件。它通过提供一系列的API,使得开发者可以方便地创建、修改和解析这些文件的各个部分,...
1. **Java导出Excel的组件**:Apache POI提供了API,使得Java程序员能够创建、修改和读取Excel文件。它支持老版的.BIFF8格式(XLS)以及较新的OOXML格式(XLSX)。这在数据处理、报表生成、数据分析等领域非常有用,...
总结来说,Apache POI是一个强大的Java库,能够处理Microsoft Office文件,尤其适用于Excel的数据导入和导出。通过使用提供的jar包和源码,开发者可以轻松地在Java应用中实现Excel文件的读写功能,从而提升工作效率...
Apache POI 是一个开源项目,它提供了Java API来处理Microsoft Office格式的文件,如XLS(Excel),DOC(Word)和PPT。在我们的场景中,我们将专注于PPT文件的创建。 2. **POI与PPT文件结构**: PowerPoint文档由...
在IT行业中,Apache POI是一个广泛使用的库,主要用于读取、写入以及操作Microsoft Office格式的文件,如Word、Excel和PowerPoint。本项目聚焦于使用Apache POI库按照预设的Word模板生成合同,并进一步将生成的合同...