我的用法
sheet.setRowView(5,60,false);Label label0 = new Label(0, 5, "豆豆");
sheet.addCell(label0);
Label label1 = new Label(1, 5, "小豆子");
sheet.addCell(label1); 想把Excel第五行的高度设为 60
可是不管我用
sheet.setRowView(5,60);
还是sheet.setRowView(5,60,true);
以及sheet.setRowView(5,60,false);第五行的高度都是很小的,连里面的内容都看不到,请问题出在哪里.
肯请各位高手给指点一下,最好有代码示例一下!
import jxl.Workbook;
import jxl.write.Label;
import jxl.format.Colour;
import java.io.IOException;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WriteException;
import jxl.format.UnderlineStyle;
import jxl.write.WritableWorkbook;
import jxl.read.biff.BiffException;
import jxl.format.Alignment;
import jxl.format.VerticalAlignment;
import jxl.format.BorderLineStyle;
import jxl.format.Border;public class TestConfigStyle { public static void main(String args[]) { WritableWorkbook book = null; try {
//Excel获得文件
Workbook wb = Workbook.getWorkbook(new File("测试.xls")); //打开一个文件的副本,并且指定数据写回到原文件
book = Workbook.createWorkbook(new File("测试.xls"), wb); //添加一个工作表
WritableSheet sheet = book.createSheet("f",5); WritableFont wf = new WritableFont(WritableFont.createFont("华文新魏"), 18,
WritableFont.BOLD, true,
UnderlineStyle.NO_UNDERLINE,
Colour.PINK2);
jxl.write.WritableCellFormat wcfF = new jxl.write.WritableCellFormat(wf);
wcfF.setAlignment(Alignment.GENERAL);
wcfF.setVerticalAlignment(VerticalAlignment.CENTRE);
wcfF.setWrap(true);
wcfF.setBorder(Border.TOP,BorderLineStyle.MEDIUM_DASH_DOT_DOT,Colour.ORANGE);
jxl.write.Label label = new jxl.write.Label(2, 2, "Merry Christmas !",
wcfF);
sheet.setRowView(2,3000,false);
sheet.setColumnView(2,80);
sheet.addCell(label); book.write();
}
catch (IOException ioe) {
ioe.printStackTrace();
}
catch (BiffException be) {
be.printStackTrace();
}
catch (WriteException we) {
we.printStackTrace();
}
finally { try {
if (book != null) {
book.close();
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
catch (WriteException we) {
we.printStackTrace();
}
}
}
}ok了~