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. nodejs的request创建的get和post请求,带参数

    1.导入request : var request = require('request'); 2.get请求 request({ timeout:5000, // 设置超时 method:'GET' ...

  2. iOS - UIButton折行文字显示设置

    首先在控制器中创建一个button - (void)viewDidLoad { [super viewDidLoad]; UIButton * button = [[UIButton alloc] i ...

  3. lua coroutine for iterator

    背景 前面的文章演示了使用闭包函数实现 状态的迭代器. 本文演示使用 coroutine来产生迭代器的例子. coroutine迭代器例子 -- 遍历二叉树 local binary_tree = { ...

  4. Spting--DI/IOC

    DI/IOC <bean> 代表由容器构建的对象(通过反射构建,且类必须有无参的构造方法)  公共属性 id="唯一的id" 在容器中是唯一的 name="类 ...

  5. iptables参数详解

    iptables参数详解 搬运工:尹正杰 注:此片文章来源于linux社区. Iptalbes 是用来设置.维护和检查Linux内核的IP包过滤规则的. 可以定义不同的表,每个表都包含几个内部的链,也 ...

  6. Python爬虫学习

    lxml相关 http://blog.csdn.net/kl28978113/article/details/52241678  lxml安装 http://www.lfd.uci.edu/~gohl ...

  7. iOS开发:(线程篇-上)线程和进程

    iOS开发多线程篇—多线程简单介绍 一.进程和线程 1.什么是进程 进程是指在系统中正在运行的一个应用程序 每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内 比如同时打开QQ.Xcod ...

  8. Ubuntu14.04台式机r8169有线网卡驱动问题

    由于台式在安装了Ubuntu14.04后插入网线后灯不亮,不能使用有线网. 查找资料发现原来是网卡驱动问题,解决办法如下: 1.查看网卡驱动名称 lspci -v 找到以太网连接的kernel dri ...

  9. MySQL的create table as 与 like区别

    对于MySQL的复制相同表结构方法,有create table as 和create table like 两种,区别是什么呢? ? 1 create table t2 as select * fro ...

  10. Scala基础语法

    /* 学慕课网上<Scala程序设计>课程跟着敲的代码 作为代码参考也是很好的 在scala_ide.org上下载eclipse IDE,新建一个worksheet,就可以像在xcode的 ...