import java.io.File;

import jxl.CellView;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.NumberFormats;
import jxl.format.VerticalAlignment;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;

public class Excel {
    private static final String TAG = "Excel";

    private static final String TABLE_HEADER[] = { "A", "B", "C", "D", "E",
            "F", "G", "H", "I", "crash", "G", "K", "L" };

    , , , , , ,
            , , , , , ,  };

    private String name;
    private WritableCellFormat headerDefaultFormat;
    private WritableCellFormat cellDefaultFormat;

    private int minTimeIndex;

    private WritableCellFormat getHeaderCellDefaultStyle() {
        // WritableFont.createFont("宋体"):设置字体为宋体 10:设置字体大小
        // WritableFont.BOLD:设置字体加粗(BOLD:加粗 NO_BOLD:不加粗) false:设置非斜体
        // UnderlineStyle.NO_UNDERLINE:没有下划线
        WritableFont font = ,
                WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE);
        WritableCellFormat format = new WritableCellFormat();
        format.setFont(font);

        try {
            format.setWrap(false);
            // 设置单元格背景色
            format.setBackground(Colour.GREEN);
            format.setVerticalAlignment(VerticalAlignment.CENTRE);
            // 表头内容水平居中显示
            format.setAlignment(Alignment.CENTRE);
            // format.setShrinkToFit(true);
            // 设置表头表格边框样式,整个表格线为粗线、黑色
            format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
        } catch (WriteException e) {
            Log.e(TAG, "Fail to getHeaderCellDefaultStyle():");
            Log.e(TAG, e.getMessage());
        }

        return format;
    }

    private WritableCellFormat getNormalCellStyle() {
        WritableFont font = ,
                WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE);
        WritableCellFormat format = new WritableCellFormat(NumberFormats.TEXT);
        format.setFont(font);
        try {
            format.setBackground(Colour.BLACK);
            format.setVerticalAlignment(VerticalAlignment.CENTRE);
            format.setAlignment(Alignment.CENTRE);
            format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
        } catch (WriteException e) {
            Log.e(TAG, "Fail to getNormalCellStyle():");
            Log.e(TAG, e.getMessage());
        }

        return format;
    }
}

jxl_1的更多相关文章

随机推荐

  1. 终端检测HTTPS服务端

    nscurl --ats-diagnostics --verbose https:ssl.tianwensm.xyz

  2. Css定位之absolute_慕课网课程笔记

    absolute和float 绝对定位和浮动有相似之处,即都有破坏性和包裹性,破坏性是指其会导致包裹自身的复原塌陷,包裹性是float的天赋技能,对于绝对定位来说,其会包括子元素 越独立越强大 1.去 ...

  3. l创建Excel文件

    最近的项目中遇到需要将List<Map<String,String>>存储到Excel文件中,为满足此需求设计实现了如下函数: /** * 将MapList转化为Excel文件 ...

  4. css元素排列

    有时候元素的排列没有预想的效果,考虑是不是margin和padding的影响

  5. hduoj 1286 找新朋友

    http://acm.hdu.edu.cn/showproblem.php?pid=1286 找新朋友 Time Limit: 2000/1000 MS (Java/Others) Memory Li ...

  6. mysql 触发器示例和注解

    -- 格式 CREATE TRIGGER 触发器名称 AFTER|before insert|update|delete ON 触发表 FOR EACH ROW BEGIN insert into 处 ...

  7. xhtml 和 html 的区别

    xhtml遵循xml文档规则,对于书写比较严格,相对于html来说,主要有以下不同: 标签不能重叠,可以嵌套标签与属性都要小写标签都要有始有终,要么以</p>形式结束,要么以<br ...

  8. Canvas: Out of system resources

    一个手写板的项目 在线程中操作Canvas画用户的笔记, 画不了几笔就卡住不画了, 然后保存到另外的image时 提示“Out of system Resource”错误, 百思不得姐 中间考虑是不是 ...

  9. Thinkphp:有你真好

    ThinkPHP是为了简化企业级应用开发和敏捷WEB应用开发而诞生的.最早诞生于2006年初,2007年元旦正式更名为ThinkPHP,并且遵循Apache2开源协议发布.ThinkPHP从诞生以来一 ...

  10. Notepade ++ 替换每行最后的换行符

    Steps: 1. Copy the file need to be replaced into Notepade ++ 2. Ctrl+A to select all->Ctrl+F to p ...