excelobject.java

来自「struts+spring+hibernate自创框架」· Java 代码 · 共 99 行

JAVA
99
字号
package com.pegasus.framework.util.export.model;

import java.io.Serializable;

import jxl.format.BoldStyle;
import jxl.format.Colour;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WriteException;

import com.pegasus.framework.util.export.ExcelExport;

public class ExcelObject implements Serializable {
	
	private String value;
	private WritableCellFormat format;
	
	public ExcelObject(String value) {
		this.value = value;
		format = new WritableCellFormat();
	}
	
	public ExcelObject(String value,WritableCellFormat format) {
		this.value = value;
		this.format = format;
	}
	
	public ExcelObject(String value,WritableFont wfc) {
		this.value = value;
		this.format = new WritableCellFormat(wfc);
	}
	
	public ExcelObject(String value,Colour color) {
		WritableFont wfc = ExcelExport.createDefaultWcf();
		try {
			wfc.setColour(color);
		} catch (WriteException e) {
		}
		this.value = value;
		this.format = new WritableCellFormat(wfc);
	}
	
	public ExcelObject(String value,boolean isBold,Colour color) {
		WritableFont wfc = ExcelExport.createDefaultWcf();
		try {
			if(color != null)
				wfc.setColour(color);
			if(isBold)
				wfc.setBoldStyle(WritableFont.BOLD);
		} catch (WriteException e) {
		}
		this.value = value;
		this.format = new WritableCellFormat(wfc);
	}
	
	public ExcelObject(String value,boolean isBold) {
		WritableFont wfc = ExcelExport.createDefaultWcf();
		try {
			if(isBold)
				wfc.setBoldStyle(WritableFont.BOLD);
		} catch (WriteException e) {
		}
		this.value = value;
		this.format = new WritableCellFormat(wfc);
	}
	
	
	
	/**
	 * @return Returns the format.
	 */
	public WritableCellFormat getFormat() {
		return format;
	}
	/**
	 * @param format The format to set.
	 */
	public void setFormat(WritableCellFormat format) {
		this.format = format;
	}
	/**
	 * @return Returns the value.
	 */
	public String getValue() {
		return value;
	}
	/**
	 * @param value The value to set.
	 */
	public void setValue(String value) {
		this.value = value;
	}
	
	
	
	
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?