`

JXL生成复杂的EXCEL

    博客分类:
  • java
 
阅读更多
    public String ExcelTaskReport(String orderid) throws RowsExceededException, WriteException, IOException{		
    	String reportFileName = null;
		File folder = null;
		File file = null;
		WritableWorkbook workbook = null;
		try {
		PATask task = this.get(Long.parseLong(orderid));
		StringBuffer sb = new StringBuffer();
		if(task.getBranchId()!=null){
			sb.append(" select apt.order_name,api.index_level,decode(api.index_type,'1','定量','2','定性'), ");
			sb.append(" api.index_name,aptd.weight_factor,aptd.target_value,api.parent_id,api.id ");
			sb.append(" from ASY_PA_TASK apt inner join ASY_PA_TASK_DETAIL aptd on apt.id = aptd.order_id ");
			sb.append(" inner join ASY_PA_INDEX api on aptd.index_id = api.id inner join ASY_BRANCH_INFO abi ");
			sb.append(" on apt.branch_id = abi.id and apt.id =  ");
			sb.append(orderid);
			sb.append(" order by api.id,api.index_level ");
		}else{
			sb.append(" select apt.order_name,api.index_level,decode(api.index_type,'1','定量','2','定性'), ");
			sb.append(" api.index_name,aptd.weight_factor,aptd.target_value,api.parent_id,api.id ");
			sb.append(" from ASY_PA_TASK apt inner join ASY_PA_TASK_DETAIL aptd on apt.id = aptd.order_id ");
			sb.append(" inner join ASY_PA_INDEX api on aptd.index_id = api.id inner join asy_branch_dept abd on abd.id = apt.department_id ");
			sb.append(" and apt.id =  ");
			sb.append(orderid);
			sb.append(" order by api.id,api.index_level ");
		}
		
			

			SQLQuery query = baseDao.getHibernate().getSessionFactory()
					.getCurrentSession().createSQLQuery(sb.toString());
			List<Object[]> result = query.list();
                   
			//一级指标list
			List<PATaskExcel> reports = new ArrayList<PATaskExcel>();
			//二级指标list
			List<PATaskExcel> reports1 = new ArrayList<PATaskExcel>();
			//三级指标list
			List<PATaskExcel> reports2 = new ArrayList<PATaskExcel>();
			//指标分区
			for (Object[] r : result) {
				PATaskExcel report = wrapperExcelTaskReport(r);
				if(report.getIndex_level().equals("1")){
					reports.add(report);
				}
                if(report.getIndex_level().equals("2")){
                	reports1.add(report);
				}
                if(report.getIndex_level().equals("3")){
                	reports2.add(report);
				}
			}
			SecUser secUser = RequestHandler.getContextRequestHandler().getCurrentUser();
			BranchInfo branchInfo = baseDao.findUniqueBy(BranchInfo.class,
					"id", new Long(secUser.getBranchId().getId()), false);
			String branchCode = StringUtils.trim(branchInfo.getCode());
			String filename = returnfilename(reports);
			// ## File ##
			reportFileName = Constants.reportRoot + File.separator + branchCode + File.separator;

			folder = new File(reportFileName);
			if (!folder.exists()) {
				folder.mkdirs();
			}

			SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
			reportFileName +="KHZB_" + sdf.format(new Date()) + ".xls";
			file = new File(reportFileName);
			if (file.exists()) {
				file.delete();
			}
			// ## 样式 ##
			// 大标题的格式
			WritableCellFormat headerFormat = new WritableCellFormat(
					new WritableFont(WritableFont.ARIAL, 14, WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK));
			headerFormat.setAlignment(Alignment.CENTRE);
			headerFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
			
			// 列标题的格式
			WritableCellFormat columnFormat = new WritableCellFormat(
					new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK));
			columnFormat.setAlignment(Alignment.CENTRE);
			columnFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
			columnFormat.setBorder(Border.ALL, BorderLineStyle.THIN,Colour.BLACK);

			// ## Write Excel ##
			workbook = Workbook.createWorkbook(file);
			WritableSheet sheet = workbook.createSheet("sheet0", 0);
			
			// 写表头
			//sheet.mergeCells(0, 0, 5, 0);
			//sheet.addCell(new Label(0, 0,filename,headerFormat));
			//有3级指标,必然有2级指标和1级指标
			int rowIndex2 = 0;
			if(reports2.size()!=0 && reports1.size()!=0 && reports.size()!=0){
				//头部
				sheet.mergeCells(0, 0, 5, 0);
				sheet.addCell(new Label(0, 0,filename,
						headerFormat));
				String[] labels = { "一级指标", "权重%","二级指标", "三级指标","指标类型","年度目标值",};
				
				for (int i = 0; i < labels.length; i++) {
					sheet.addCell(new Label(i, 1, labels[i], columnFormat));
				}
				//身体
				int rowIndex = 2;
				
				//链型指标表
				
				//一级指标
				for(int index = 0 ;index<reports.size();index++){
				int a = 0,b = 0;int c =0;int d = 0;
				
					List<PATaskExcel> reports3 =new ArrayList<PATaskExcel>();
					PATaskExcel taskExcel = reports.get(index);
					reports3.add(taskExcel);
					String taskid = taskExcel.getTaskid();
					//有木有2级指标
					for(int index2 = 0;index2<reports1.size();index2++){
						PATaskExcel taskExcel2 = reports1.get(index2);
						String parent_id = taskExcel2.getParent_id();
						String taskid1 = taskExcel2.getTaskid();
						if(taskid.equals(parent_id)){
							reports3.add(taskExcel2);
							a++;
						}else{
							continue;
						}
						//有木有三级指标
						for(int index3 = 0;index3<reports2.size();index3++){
							PATaskExcel taskExcel3 = reports2.get(index3);
							if(taskid1.equals(taskExcel3.getParent_id())){
								reports3.add(taskExcel3);
								b++;				
							}else{
								continue;
							}
						}
					}
					//mergeCells column, row column1, row1
					//有2级指标,有3级指标
					for(int index4 = 0;index4<reports3.size();index4++){	
						PATaskExcel taskExcel4 = reports3.get(index4);
						sheet.setColumnView(0, 20);
						sheet.setColumnView(1, 10);
						sheet.setColumnView(2, 20);
						sheet.setColumnView(3, 20);
						sheet.setColumnView(4, 10);
						sheet.setColumnView(5, 90);
							 if(a==0){
								 if(taskExcel4.getIndex_level().equals("1")){
								    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
									sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
									sheet.addCell(new Label(2, rowIndex, "", columnFormat));
									sheet.addCell(new Label(3, rowIndex, "", columnFormat));
									sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
									sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
									rowIndex++;
								 }
							 }else if(a!=0){	 
								 if(b!=0){
									 if(a<b){
										 if(taskExcel4.getIndex_level().equals("1")){
											 if(b%2==1){
												 int count = 0;
												 int q = 0;
												for(int index5 = 0;index5<reports3.size();index5++){
													PATaskExcel taskExcel5 = reports3.get(index5);
													if(taskExcel5.getIndex_level().equals("2")){
														count = this.getCountlevel(orderid, taskExcel5.getTaskid(),"3",task);
													}
												}
												if(count == 0){
													    sheet.mergeCells(0, rowIndex, 0, rowIndex+b);
											 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+b);
											 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
														sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
														sheet.addCell(new Label(2, rowIndex, "", columnFormat));
														sheet.addCell(new Label(3, rowIndex, "", columnFormat));
														sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
														sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
												}else{
													    sheet.mergeCells(0, rowIndex, 0, rowIndex+b-1);
											 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+b-1);
											 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
														sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
														sheet.addCell(new Label(2, rowIndex, "", columnFormat));
														sheet.addCell(new Label(3, rowIndex, "", columnFormat));
														sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
														sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
												}   
											 }else{
												    sheet.mergeCells(0, rowIndex, 0, rowIndex+b-1);
										 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+b-1);
										 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
													sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
													sheet.addCell(new Label(2, rowIndex, "", columnFormat));
													sheet.addCell(new Label(3, rowIndex, "", columnFormat));
													sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
													sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
											 }
										}
									 }else if(a==b){
										 if(taskExcel4.getIndex_level().equals("1")){
											 if(b%2==1){
												    sheet.mergeCells(0, rowIndex, 0, rowIndex+b-1-a+b);
										 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+b-1-a+b);
										 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
													sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
													sheet.addCell(new Label(2, rowIndex, "", columnFormat));
													sheet.addCell(new Label(3, rowIndex, "", columnFormat));
													sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
													sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
											 }else{
												    sheet.mergeCells(0, rowIndex, 0, rowIndex+b);
										 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+b);
										 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
													sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
													sheet.addCell(new Label(2, rowIndex, "", columnFormat));
													sheet.addCell(new Label(3, rowIndex, "", columnFormat));
													sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
													sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
											 }
										 }
									 }else{
										 if(taskExcel4.getIndex_level().equals("1")){
											    sheet.mergeCells(0, rowIndex, 0, rowIndex+a-1);
									 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+a-1);
									 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
												sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
												sheet.addCell(new Label(2, rowIndex, "", columnFormat));
												sheet.addCell(new Label(3, rowIndex, "", columnFormat));
												sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
												sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
										} 
									 }
								 }else{
									 if(taskExcel4.getIndex_level().equals("1")){
									    sheet.mergeCells(0, rowIndex, 0, rowIndex+a-1);
							 		    sheet.mergeCells(1, rowIndex, 1, rowIndex+a-1);
							 		    sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
										sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
										sheet.addCell(new Label(2, rowIndex, "", columnFormat));
										sheet.addCell(new Label(3, rowIndex, "", columnFormat));
										sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
										sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
									 }
								 }
							 }
						//二级指标
						if(taskExcel4.getIndex_level().equals("2")){
								int count = this.getCountlevel(orderid, taskExcel4.getTaskid(),"3",task);									
					
								if(count>1){
									//rowIndex = rowIndex + count;
									Range mergeCells = sheet.mergeCells(2, rowIndex, 2, rowIndex+count-1);
								    System.out.println(mergeCells.toString());
								    sheet.addCell(new Label(2, rowIndex, taskExcel4.getIndex_name(), columnFormat));
									
								}else if(count == 1){
									sheet.addCell(new Label(2, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								}else if(count==0){
									sheet.addCell(new Label(2, rowIndex, taskExcel4.getIndex_name(), columnFormat));
									sheet.addCell(new Label(3, rowIndex, "", columnFormat));
									sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
									sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
									rowIndex++;
								}	
						}
						//三级指标
				      if(taskExcel4.getIndex_level().equals("3")){
							if(d==0){
								sheet.addCell(new Label(3, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
								sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));	
							}
							if(d>0){
								sheet.addCell(new Label(3, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								sheet.addCell(new Label(4, rowIndex, taskExcel4.getIndex_type(), columnFormat));
								sheet.addCell(new Label(5, rowIndex, taskExcel4.getTarget_value(), columnFormat));
							}
							d++;
							rowIndex++;
						}
					}
				}
				
				
				//只有2级指标,没有3级指标
			}else if(reports1.size()!=0 && reports2.size()==0 && reports.size()!=0){
				//头部
				sheet.mergeCells(0, 0, 4, 0);
				sheet.addCell(new Label(0, 0,filename,
						headerFormat));
				String[] labels = { "一级指标", "权重%","二级指标","指标类型","年度目标值",};
				for (int i = 0; i < labels.length; i++) {
					sheet.addCell(new Label(i, 1, labels[i], columnFormat));
				}
				//身体
				int rowIndex = 2;
				//链型指标表
				for(int index = 0 ;index<reports.size();index++){
					//sheet.setColumnView(rowIndex, 60);
					int a = 0,b = 0;
					List<PATaskExcel> reports3 =new ArrayList<PATaskExcel>();
					PATaskExcel taskExcel = reports.get(index);
					reports3.add(taskExcel);
					String taskid = taskExcel.getTaskid();
					for(int index2 = 0;index2<reports1.size();index2++){
						PATaskExcel taskExcel2 = reports1.get(index2);
						String parent_id = taskExcel2.getParent_id();
						String taskid1 = taskExcel2.getTaskid();
						if(taskid.equals(parent_id)){
							reports3.add(taskExcel2);
							a++;
						}else{
							continue;
						}
						for(int index3 = 0;index3<reports2.size();index3++){
							b++;
							PATaskExcel taskExcel3 = reports2.get(index2);
							if(taskid1.equals(taskExcel3.getParent_id())){
								reports3.add(taskExcel3);
							}else{
								continue;
							}
						}
					}
					
					int c = 0;
					for(int index4 = 0;index4<reports3.size();index4++){
					
						PATaskExcel taskExcel4 = reports3.get(index4);
						sheet.setColumnView(0, 20);
						sheet.setColumnView(1, 10);
						sheet.setColumnView(2, 20);
						sheet.setColumnView(3, 10);
						sheet.setColumnView(4, 90);
						if(a == 0){
							if(taskExcel4.getIndex_level().equals("1")){								
								sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
								sheet.addCell(new Label(2, rowIndex, "", columnFormat));
								sheet.addCell(new Label(3, rowIndex, taskExcel4.getIndex_type(), columnFormat));
								sheet.addCell(new Label(4, rowIndex, taskExcel4.getTarget_value(), columnFormat));
								rowIndex++;
						     }
						}else{
							if(taskExcel4.getIndex_level().equals("1")){
								sheet.mergeCells(0, rowIndex, 0, rowIndex+a-1);
								sheet.mergeCells(1, rowIndex, 1, rowIndex+a-1);
								sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor(), columnFormat));
								sheet.addCell(new Label(2, rowIndex, "", columnFormat));
								sheet.addCell(new Label(3, rowIndex, taskExcel4.getIndex_type(), columnFormat));
								sheet.addCell(new Label(4, rowIndex, taskExcel4.getTarget_value(), columnFormat));
							}
						}
						
						if(taskExcel4.getIndex_level().equals("2")){
							if(c==0){
								sheet.addCell(new Label(2, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								sheet.addCell(new Label(3, rowIndex, taskExcel4.getIndex_type(), columnFormat));
								sheet.addCell(new Label(4, rowIndex, taskExcel4.getTarget_value(), columnFormat));
							}
							if(c>0){
								//int j=++rowIndex;
								sheet.addCell(new Label(2, rowIndex, taskExcel4.getIndex_name(), columnFormat));
								sheet.addCell(new Label(3, rowIndex, taskExcel4.getIndex_type(), columnFormat));
								sheet.addCell(new Label(4, rowIndex, taskExcel4.getTarget_value(), columnFormat));
							}
							c++;
							rowIndex++;
						}
					}
					
				}
				
				//只有1级指标
			}else if(reports.size()!=0 && reports1.size()==0 && reports2.size()==0){
				//头部
				sheet.mergeCells(0, 0, 3, 0);
				sheet.addCell(new Label(0, 0,filename,
						headerFormat));
				String[] labels = { "一级指标", "权重%","指标类型","年度目标值",};
				for (int i = 0; i < labels.length; i++) {
					sheet.addCell(new Label(i, 1, labels[i], columnFormat));
				}
				//身体
				
				int rowIndex = 2;
				for(int index = 0 ;index<reports.size();index++){
					List<PATaskExcel> reports3 =new ArrayList<PATaskExcel>();
					PATaskExcel taskExcel = reports.get(index);
					reports3.add(taskExcel);
					for(int index4 = 0;index4<reports3.size();index4++){
						sheet.setColumnView(0, 20);
						sheet.setColumnView(1, 10);
						sheet.setColumnView(2, 10);
						sheet.setColumnView(3, 90);
						PATaskExcel taskExcel4 = reports3.get(index4);
						sheet.addCell(new Label(0, rowIndex, taskExcel4.getIndex_name(), columnFormat));
						sheet.addCell(new Label(1, rowIndex, taskExcel4.getWeight_factor()+"%", columnFormat));
						sheet.addCell(new Label(2, rowIndex, taskExcel4.getIndex_type(), columnFormat));
						sheet.addCell(new Label(3, rowIndex, taskExcel4.getTarget_value(), columnFormat));
						rowIndex++;
					}
				}
			}
			workbook.write();
		} finally {
			if (folder != null)
				folder = null;
			if (file != null)
				file = null;
			if (workbook != null) {
				workbook.close();
				workbook = null;
			}
		}

		return reportFileName;
		
	}

 

分享到:
评论

相关推荐

    jxl模版生成excel

    "jxl模版生成excel" 指的是使用JExcelAPI(简称jxl)这个Java库来创建基于模板的Excel文件。JExcelAPI是一个开源项目,允许程序开发者读写Microsoft Excel文件,它支持从Java数据结构直接导出到Excel格式,同时也可...

    jxl方式生成excel表格.zip

    本资源提供了一个利用jxl库实现Java程序中生成Excel表格的解决方案。jxl是一个广泛使用的开源Java库,它允许开发者读取、写入和修改Microsoft Excel文件。 首先,我们来详细了解一下jxl库。jxl库支持多种Excel操作...

    java利用jxl生成excel文件

    Java使用JXL库生成Excel文件是一项常见的任务,特别是在数据处理、报表生成或导出时。JXL是一个开源的Java库,允许我们...JXL提供了广泛的API来处理各种复杂的Excel操作,是Java环境下生成Excel文件的一个实用工具。

    jxl生成excel的通用方法

    使用jxl生成excel的通用方法,参数List&lt;?&gt;数据,LinkedHashMap,String&gt;实体类属性名和中文列名的键值对

    jxl 自动生成excel

    例子如下: Object是一个对象实体类,如Studnet.java. List 是一个对象集合,后面的是输出路径. WriteExcel rw=new WriteExcel(); rw.writeExcel(new Object(), List, "f:/a.xls","库存表");

    poi jxl 生成EXCEL 报表

    在Java编程环境中,生成Excel报表是一项常见的任务,尤其在数据处理和数据分析中。Apache POI 和 JExcelAPI(JXL)是两个广泛使用的库,分别用于处理Microsoft Office的POI格式(包括Excel)和Java环境中的Excel文件...

    [转]java struts2+jxl生成并导出Excel

    这篇博客文章结合了这两个技术,展示了如何在Struts2应用中生成Excel文件并将其导出给用户下载。 在Java开发中,导出数据到Excel是常见的需求,特别是在处理大量结构化数据时,如报表或数据分析。JXL库提供了一个...

    jxl 生成excel 简易教程

    jxl是对excel强有力的操纵工具,它具有丰富的API可以满足对excel的各种开发需要。

    JXLExcel生成简单excel表

    "JXLExcel生成简单excel表"是一个基于JXL库的插件,它简化了使用Java创建Excel文件的过程,使得开发者无需深入理解JXL库的复杂性就能快速生成基本的Excel表格。 JXL,全称Java Excel API,是一个开源的Java库,专门...

    java操作jxl生成excel的简化jar包

    自己封装的方法,调用 XlHelper.getXl(List&lt;?&gt; voList , Object head , OutputStream ops)方法,直接返回需要的excel,而不需要再去写jxl的方法。第一个参数voList 是excel里的内容,第二个参数head是excel表头。第...

    利用Jxl生成excel文件

    这篇博客“利用Jxl生成excel文件”提供了关于如何使用Jxl库创建Excel文档的指导。 首先,Jxl库允许开发者在Java程序中直接操作Excel格式的数据,而无需依赖Microsoft Office套件。它支持多种Excel功能,如单元格...

    用jxl生成EXCEL表格

    用jxl生成EXCEL表格,一个非常简单易懂的写法。

    java JXL导入导出Excel源码及jfreechart 生成折线图,饼图

    java JXL导出Excel源码及jfreechart 生成折线图,饼图 java JXL导出Excel源码及jfreechart 生成折线图,饼图 java JXL导出Excel源码及jfreechart 生成折线图,饼图

    JXL生成excel报表

    在IT行业中,生成Excel报表是常见的数据展示和分析任务,而JXL库为Java开发者提供了一个强大且便捷的解决方案。JXL,全称Java Excel API,是一个开源的Java库,专为读取、写入以及修改Excel文件设计。它允许程序员在...

    使用JXL生成Excel实例详解

    这篇博客“使用JXL生成Excel实例详解”将深入探讨如何利用JXL库来创建Excel文件。 首先,要开始使用JXL,你需要在项目中添加JXL的依赖。如果你使用的是Maven,可以在pom.xml文件中添加以下依赖: ```xml ...

    使用jxl.jar在Android中操作Excel表格

    在Android开发中,有时我们需要与Excel文件进行交互,例如读取数据、写入数据或进行更复杂的操作。这里我们将深入探讨如何使用jxl.jar库在Android环境中操作Excel表格,特别是处理隐藏表的情况。 首先,jxl是一个...

    java通过jxl生成excel文档

    Java通过JXL库生成Excel文档是一项常见的任务,尤其在数据导出、报表生成等领域非常实用。JXL是一个Java API,允许我们读写Microsoft Excel文件,而无需依赖Microsoft Office。在这个过程中,我们可以创建新的工作簿...

    jxl对excel添加水印(含有setWaterMarkImage方法).zip

    在Java编程环境中,处理Excel文件是一项常见的任务,特别是在数据导入导出、报表生成等领域。`jxl`库是一个广泛使用的开源库,它允许开发者用Java读取、写入和修改Excel文件。在这个特定的场景中,我们将探讨如何...

    JXL操作EXCEL 数据库导出EXCEL相关文件

    这对于创建更复杂的Excel报告非常有用。 总结来说,JXL是Java开发人员处理Excel文件的一个强大工具,它允许我们轻松地读取、写入和修改Excel数据。通过结合数据库操作,我们可以方便地将数据库中的数据导出为Excel...

    jxl创建下拉列表

    下面是一个更复杂的示例代码,展示了如何使用jxl创建带有不同数据样式的Excel文件,包括下拉框: ```java import java.io.FileOutputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; ...

Global site tag (gtag.js) - Google Analytics