if (("kehu")) {// 设置宽度
//定义列宽
(0, 13);
(1, 7);
(2, 16);
(3, 7);
(4, 16);
(5, 7);
(6, 16);
(7, 7);
(8, 16);
(9, 7);
(10, 16);
(11, 7);
(12, 16);
//定义行高
(0, 380);
(1,450);
(2,380);
(3,400);
(4,380);
(5,760);
}
try {
// 保存内容到execl中
// 保存表头到cell中
// 首行:附表
WritableFont wtf0 = new WritableFont(("宋体"),
13, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt0 = new WritableCellFormat(wtf0);
(new Label(0, 0, "附表",wcfmt0));
// 第二行
WritableFont wtf1 = new WritableFont(("黑体"),
19, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt1 = new WritableCellFormat(wtf1);
();
();
(new Label(0, 1, "《机动车销售统一发票领用存月报表(汇总)》", wcfmt1));
(0, 1, 12, 1); // 合并单元格(列、行)第一变量是列,第二变量是行--第三个变量是到第几列,第四变量是行
//第三行
WritableFont wtf2 = new WritableFont(("宋体"),12, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt2 = new WritableCellFormat(wtf2);
WritableCellFormat wcfmt3 = new WritableCellFormat(wtf2);
WritableCellFormat wcfmt4 = new WritableCellFormat(wtf2);
();
();
();
();
();
();
(new Label(0, 2, "企业名称: " + (), wcfmt2));
(new Label(5, 2, "纳税人识别号: " + (),wcfmt3));
String ssq=();
String year=(0, 4);
String month=(5, 7);
(new Label(10, 2, "所属期限:" + year+"年"+month+"月", wcfmt4));
(0, 2, 4, 2);
(5, 2, 9, 2);
(10, 2, 12, 2);
// 第四行表头
WritableFont wtf3 = new WritableFont(("黑体"),
12, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt5 = new WritableCellFormat(wtf3);
(, );
// 设置右边框线为实线
(, );
(, );
();
();
WritableFont wtf4 = new WritableFont(("黑体"),
12, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt6 = new WritableCellFormat(wtf4);
();
();
(, );
// 设置右边框线为实线
(, );
(, );
(new Label(0, 3, "项目", wcfmt5));
(new Label(1, 3, "期初库存", wcfmt5));
(new Label(3, 3, "本期领购", wcfmt5));
(new Label(5, 3, "本期开具", wcfmt5));
(new Label(7, 3, "本期交回未开具数量", wcfmt6));
(new Label(9, 3, "本期作废或遗失", wcfmt5));
(new Label(11, 3, "期末库存", wcfmt5));
(1, 3, 2, 3); // 合并单元格(列、行)
(3, 3, 4, 3); // 合并单元格(列、行)
(5, 3, 6, 3); // 合并单元格(列、行)
(7, 3, 8, 3); // 合并单元格(列、行)
(9, 3, 10, 3); // 合并单元格(列、行)
(11, 3, 12, 3); // 合并单元格(列、行)
//第五行表头
WritableFont wtf8 = new WritableFont(("宋体"),11, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt8 = new WritableCellFormat(wtf8);
();
();
(, );
// 设置右边框线为实线
(, );
(, );
(new Label(0, 4,"", wcfmt8));
for(int u=1;u<13;u++){
number = new (u,4,u);
(wcfmt8);
(number);
}
//第六行表头
WritableFont wtf9= new WritableFont(("宋体"),11, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt9 = new WritableCellFormat(wtf9);
();
();
(, );
// 设置右边框线为实线
(, );
(, );
(true);// 自动换行
(new Label(0, 5,"机动车销售统一发票", wcfmt9));
for(int v=1;v<13;v++){
if(v%2==0){
(new Label(v, 5,"起止号码", wcfmt9));
}else{
(new Label(v, 5,"份数", wcfmt9));
}
}
WritableFont wtf7 = new WritableFont(("宋体"),
7, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt7 = new WritableCellFormat(wtf7);
();
();
(, );
// 设置右边框线为实线
(, );
(, );
WritableFont wtf10 = new WritableFont(("宋体"),
11, WritableFont.NO_BOLD, false);
WritableCellFormat wcfmt10 = new WritableCellFormat(wtf10);
();
();
(, );
// 设置右边框线为实线
(, );
(, );
// 设置千分隔符
// 设置垂直对齐为居中对齐
// ();
// 设置顶部边框线为实线(默认是黑色--也可以设置其他颜色)
// (, );
// 设置右边框线为实线
// (, );
for(int m=0;m<;m++){
String[] str1=str[m].split(",",13);
String ss = "";
(m+6,380);
for (int j = 0; j < 13; j++) {
ss=str1[j].toString().trim();
if(("没有任何数据!")!=0){
if(j==2||j==4||j==6||j==8||j==10||j==12){
(new Label(j, m + 6, ss+"", wcfmt7));
}
else{
if(("")||("合计")){
(new Label(j, m + 6, ss+"", wcfmt10));
}
else{
number1 = new (j,m+6,(()));
(wcfmt10);
(number1);
}
}
}else{
j=12;
m=-1;
}
}
}