可以试试JavaCellREport. http://www.javatoolsoft.com/cn
解决方案 »
- 求助,ajax的responseXML无法获取xml,网上各种方法都试过了
- 集思广益,人多力量大,发表想法
- org.springframework.beans.factory.BeanCreationException:
- 长城计算机软件与系统公司怎么样
- hibernate中模糊查询
- 开发者群 没开发经验的免进 20064958
- 一台pc如何安装两个tomcat
- 直接在服务器端解析xml和把xml扔给客户端JS解析两者的区别,孰优孰劣?
- 请问RMI JMS JNDI RMI-IIOP是什么?
- java&xml
- 求Together Edition for JBuilder X Developer的Keymaker!
- 如何在resin下配置path-mapping?
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.hssf.util.Region;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/public class TestExcelPrint { public String printExcel(List xmlList,Object doc) throws Exception{
String strName = ""; return strName;
}
static public void main(String[] args) throws Exception { FileInputStream fos = new FileInputStream("jixing.xls");
POIFSFileSystem fs = new POIFSFileSystem(fos); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheetAt(0); HSSFRow row;
HSSFCell cell; HSSFCellStyle style = wb.createCellStyle();
style = wb.createCellStyle();
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBottomBorderColor(HSSFColor.BLACK.index);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setLeftBorderColor(HSSFColor.BLACK.index);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setRightBorderColor(HSSFColor.BLACK.index);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setTopBorderColor(HSSFColor.BLACK.index);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setWrapText(true); row = sheet.getRow(3);
cell = row.getCell((short)1);
if (cell == null)
cell = row.createCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue("1111111111"); String getFieldName1 = "";
List list= null;
if (list != null) {
Iterator aa = list.iterator();
for(;aa.hasNext();){
Object doc = (Object)aa.next(); }
} for (short i = 7; i < 15; i++) { row = sheet.createRow(i); for (short j = 0; j < 10; j++) {
cell = row.createCell(j);
if (i == 8){
sheet.addMergedRegion(new Region(8,(short) 1,9,(short) 1));
} cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellStyle(style);
cell.setCellValue("" + i + "," + j); } }
FileOutputStream fileOut = new FileOutputStream("jijingout.xls");
wb.write(fileOut); fos.close(); }
}
我已经用那个控件做了个例子,现在问题是想把这个方法做成一个公共的,每个不同的统计列表都用这个方法,可就是不知道怎么设计合理,帮忙出出主意吧,兄弟们
觉得挺有意思的 都是可以自己定义的嘛XML