CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Java >  非技术区

http://jakarta.apache.org/poi/hssf/quick-guide.html

楼主qq200577()2005-09-26 19:32:52 在 Java / 非技术区 提问

http://jakarta.apache.org/poi/hssf/quick-guide.html 问题点数:1、回复次数:1Top

1 楼qq200577()回复于 2005-09-30 17:58:52 得分 1

// response.setContentType(CONTENT_TYPE);  
  // InputStream   in   =   this.getClass().getResourceAsStream(  
  // "/com/paic/cm/template/Printparticularaccountlist.xls");  
  //  
  // response.setHeader("Content-Disposition",   "attachment;filename="  
  // +   new   String("帐户明细表.xls".getBytes(),   "ISO8859_1"));  
  List   lableList   =(List)   request.getAttribute("lablelist");  
  List   valueList   =(List)   request.getAttribute("valuelist");  
   
  wb   =   new   HSSFWorkbook();  
     
  sheet   =   wb.createSheet("accountparticularInfo");  
   
  row   =   sheet.createRow(2);  
  font   =   wb.createFont();  
  HSSFRow   row1   =   null   ;  
  cellStyle   =   wb.createCellStyle();  
  cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);  
  int   i   =   -1   ;//数据标记  
   
  int   j   =   2   ;//填充数据的行数  
   
  Iterator   it1   =lableList.iterator();  
  Iterator   it2   =valueList.iterator();    
  while((it1.hasNext())   &&   (it2.hasNext())){  
  i++;  
  j++;  
  TableToLableVO   tableToLableVO   =   (TableToLableVO)it1.next();  
  AccountVO   accountVO   =(AccountVO)it2.next();  
   
          cell   =   row.createCell(   (short)   i);  
          sheet.setColumnWidth((short)i,(short)   ((   30   *   8   )   /   (   (double)   1   /   20   )));  
          font.setFontName("Arial");    
          font.setBoldweight((short)1230);  
          font.setFontHeightInPoints((short)12);  
          cellStyle.setFont(font);  
          cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
          cell.setCellStyle(cellStyle);  
          cell.setCellValue(tableToLableVO.getDisplayName());  
          row1   =   sheet.createRow(j);  
  String   lable   =   tableToLableVO.getColname();  
  if(lable.equalsIgnoreCase("ACCOUNT")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getAccount());  
  }  
  if(lable.equalsIgnoreCase("REALACCOUNT")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getRealaccount());  
  }  
  if(lable.equalsIgnoreCase("CHANGEDATE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy   h:mm"));  
  cell.setCellValue(accountVO.getChangedate());  
  }  
  if(lable.equalsIgnoreCase("CHANGEUSER")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
   
  cell.setCellValue(accountVO.getChangeuser());  
  }  
  if(lable.equalsIgnoreCase("APPROVENO")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getApproveno());  
  }  
  if(lable.equalsIgnoreCase("ACCESSORIES")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getAccessories());  
  }  
  if(lable.equalsIgnoreCase("CREATEDATE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy   h:mm"));  
  cell.setCellValue(accountVO.getCreatedate());  
  }  
  if(lable.equalsIgnoreCase("CANCELDATE")){  
  cell   =   row1.createCell(   (short)i);  
  cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy   h:mm"));  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getCanceldate());  
  }  
  if(lable.equalsIgnoreCase("BRANCHGRADE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getBranchgrade());  
  }  
  if(lable.equalsIgnoreCase("ISAUTO")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getIsauto());  
  }  
  if(lable.equalsIgnoreCase("BANKNAME")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getBankname());  
  }  
  if(lable.equalsIgnoreCase("PAYADDR")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getPayaddr());  
  }  
  if(lable.equalsIgnoreCase("BANKSIGN")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getBanksign());  
  }  
  if(lable.equalsIgnoreCase("TNO")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getTno());  
  }  
  if(lable.equalsIgnoreCase("ACCTSIGN")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getAcctsign());  
  }  
  if(lable.equalsIgnoreCase("CURRENCY")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getCurrency());  
  }  
  if(lable.equalsIgnoreCase("BANKCODE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getBankcode());  
  }  
  if(lable.equalsIgnoreCase("BANKID")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getBranchid());  
  }  
   
  if(lable.equalsIgnoreCase("BRANCHID")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getBranchid());  
  }  
  if(lable.equalsIgnoreCase("PAYOR")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getPayor());  
  }  
  if(lable.equalsIgnoreCase("PAYTYPE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getPaytype());  
  }  
  if(lable.equalsIgnoreCase("PROPERTY")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getProperty());  
  }  
  if(lable.equalsIgnoreCase("USESTATUS")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getUsestatus());  
  }  
  if(lable.equalsIgnoreCase("COMM")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getComm());  
  }  
  if(lable.equalsIgnoreCase("MULTIRULE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getMultirule());  
  }  
  if(lable.equalsIgnoreCase("DATERULE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getDaterule());  
  }  
  if(lable.equalsIgnoreCase("OPINION")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getOpinion());  
  }  
  if(lable.equalsIgnoreCase("ISDIRECT")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getIsdirect());  
  }  
  if(lable.equalsIgnoreCase("PROVCODE")){  
  cell   =   row1.createCell(   (short)i);  
  cell.setEncoding(HSSFCell.ENCODING_UTF_16);  
  cell.setCellValue(accountVO.getProvcode());  
  }  
  }  
  FileOutputStream   fileOut   =   new   FileOutputStream("d:/帐号明细表.xls");  
          wb.write(fileOut);  
          fileOut.close();  
  Top

相关问题

  • apache?
  • apache
  • 请问tomcat与apache是什么关系? jakarta又是什么?
  • Apache的POI包中公式的运用问题
  • 推荐:<Jakata Poi HSSF:纯java的Excel解决方案>
  • 用apache的poi来抽取word,excel,但封装后的包找不到!急!!
  • 请教高手,用apache的POI如何实现EXCEL中多行的复制?
  • ####用apache的封装poi来抽取word,excel,但是包中没有EXCEL的类啊?如何提取EXCEL数据?####
  • apache+tomcat
  • About Apache!

关键词

  • accountvo
  • lablelist
  • tabletolablevo
  • valuelist
  • wb
  • sheet
  • iterator
  • short
  • row
  • font

得分解答快速导航

  • 帖主:qq200577
  • qq200577

相关链接

  • CSDN Java频道
  • Java类图书
  • Java类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo