/*
格式具体如下
1、类别为A的方在一个sheet 里并设置sheetName = "A";
2、同理B类和C类都为一个sheet表
表都生成了
3、在就是怎么把A类的内容添加到sheetName 为A的sheet里面去 B都一样C
现在我生成的是把A类和B类的都生成在 C的sheet里面!
下面的应该怎么判断或者给个思路 谢了!
*/
table
td1 td2 td3 类别
1 2 3 A
1 2 1 A
1 2 3 A
1 1 3 B
1 4 3 B
1 2 4 B
1 4 3 C
1 4 1 C
1 4 4 C
*/
Map<String, Boolean> map = new HashMap<String, Boolean>();
for (TD td : listBody) {
if (td == null) {
row++;
col = 0;
continue;
}
while (map.get(col + "-" + row) != null) {
col++;
}
if (td.colspan > 1 || td.rowspan > 1) {
sheet.mergeCells(col, row, col + td.colspan - 1, row + td.rowspan - 1);
for (int i = col; i <= col + td.colspan - 1; i++) {
for (int j = row; j <= row + td.rowspan - 1; j++) {
map.put(i + "-" + j, true);
}
}
}
label = new Label(col, row, td.content);
sheet.addCell(label); map.put(col + "-" + row, true);
col += td.colspan;
}
解决方案 »
- Spring 事务配置异常
- 求struct2的中文doc文档
- struts2 checkboxlist 的问题,请大家帮帮忙啊
- 本人对未来的学习有些迷茫 前辈进来留言
- 请问hibernate要用的的几个东西的下载地址[怀疑是hibernate.org出问题了]
- html:radio标签的问题
- 调查weblogic,websphere, jboss哪种用得最多
- 我在win2003 与win2000中安装不上tomcat 5.0,请求帮助?
- [求助]??关于struts问题??
- 求教,weblogic6.1在jbuild7.0中运行license问题。
- jsp页面上传图片到mysql数据库
- DetachedCriteria 按条件查询问题
我是用数组
可能我没说明白
这是我生成sheet表的代码
这是把类别为一样的放在一个sheet里面不知道1楼明白了没!
private void export(String content, HttpServletResponse response,String chan[]) throws IOException, RowsExceededException, WriteException {
response.setContentType("application/ms-excel");
String sheetName =getCaption(content);
int s =chan.length;
String str[] = chan;
if(sheetName==null){
sheetName="sheet1";
}
sheetName = sheetName.replaceAll(":", "").replaceAll("[)]", "").replaceAll("[(]", "");
response.addHeader("Content-Disposition", "attachment; filename=" + new String(sheetName.getBytes("GBK"), "ISO-8859-1")
+ ".xls");
OutputStream os = response.getOutputStream();
wwb = Workbook.createWorkbook(os);
wwb.setProtected(true);
for (int i = 0; i < s; i++) {
sheet = wwb.createSheet(str[i], i);
}
int row = 0;
int col = 0;
Label label = null;
for(int d=0;d<s;d++ ){
if (sheetName.trim().length() > 30) {
label = new Label(col, row, str[d]);
sheet.addCell(label);
row++;
}
}