本文整理汇总了Java中jxl.write.WritableCellFormat.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java WritableCellFormat.setBorder方法的具体用法?Java WritableCellFormat.setBorder怎么用?Java WritableCellFormat.setBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jxl.write.WritableCellFormat
的用法示例。
在下文中一共展示了WritableCellFormat.setBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setExcelListTitle
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* 设置报表内容头
*
* @param listTitle
* 报表头
* @throws IOException
* @throws WriteException
*/
@Deprecated
public void setExcelListTitle(String[] listTitle) throws WriteException, IOException {
try {
irow++;
long start = System.currentTimeMillis();
wfont = new WritableFont(WritableFont.createFont("宋体"), 10, WritableFont.BOLD, false,
UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLACK);
wcfFC = new WritableCellFormat(wfont);
wcfFC.setBorder(Border.ALL, BorderLineStyle.MEDIUM);
wcfFC.setAlignment(Alignment.CENTRE);// 对齐方式
wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);// 对齐方式
for (int i = icol; i < listTitle.length; i++) {
wsheet.addCell(new Label(i, irow, listTitle[i], wcfFC));
}
trow = irow;
logger.info("title use time:" + (System.currentTimeMillis() - start));
} catch (Exception e) {
this.close();
}
}
示例2: setExcelListTitle
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* 设置报表内容头
*
* @param listTitle
* 报表头
* @throws IOException
* @throws WriteException
*/
@Deprecated
public void setExcelListTitle(String[] listTitle) throws WriteException, IOException {
try {
irow++;
long start = System.currentTimeMillis();
wfont = new WritableFont(WritableFont.createFont("宋体"), 10, WritableFont.BOLD, false,
UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLACK);
wcfFC = new WritableCellFormat(wfont);
wcfFC.setBorder(Border.ALL, BorderLineStyle.MEDIUM);
wcfFC.setAlignment(Alignment.CENTRE);// 对齐方式
wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);// 对齐方式
for (int i = icol; i < listTitle.length; i++) {
wsheet.addCell(new Label(i, irow, listTitle[i], wcfFC));
}
trow = irow;
log.info("title use time:" + (System.currentTimeMillis() - start));
} catch (Exception e) {
this.close();
}
}
示例3: format
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* 单元格的格式设置 字体大小 颜色 对齐方式、背景颜色等...
*/
public static void format() {
try {
arial14font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.BOLD);
arial14font.setColour(jxl.format.Colour.LIGHT_BLUE);
arial14format = new WritableCellFormat(arial14font);
arial14format.setAlignment(jxl.format.Alignment.CENTRE);
arial14format.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
arial14format.setBackground(jxl.format.Colour.VERY_LIGHT_YELLOW);
arial10font = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD);
arial10format = new WritableCellFormat(arial10font);
arial10format.setAlignment(jxl.format.Alignment.CENTRE);
arial10format.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
arial10format.setBackground(Colour.GRAY_25);
arial12font = new WritableFont(WritableFont.ARIAL, 10);
arial12format = new WritableCellFormat(arial12font);
arial10format.setAlignment(jxl.format.Alignment.CENTRE);//对齐格式
arial12format.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); //设置边框
} catch (WriteException e) {
e.printStackTrace();
}
}
示例4: format
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
public static void format() {
try {
arial14font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.BOLD);
arial14font.setColour(jxl.format.Colour.LIGHT_BLUE);
arial14format = new WritableCellFormat(arial14font);
arial14format.setAlignment(jxl.format.Alignment.CENTRE);
arial14format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
arial14format.setBackground(jxl.format.Colour.VERY_LIGHT_YELLOW);
arial10font = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD);
arial10format = new WritableCellFormat(arial10font);
arial10format.setAlignment(jxl.format.Alignment.CENTRE);
arial10format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
arial10format.setBackground(jxl.format.Colour.LIGHT_BLUE);
arial12font = new WritableFont(WritableFont.ARIAL, 12);
arial12format = new WritableCellFormat(arial12font);
arial12format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
} catch (WriteException e) {
e.printStackTrace();
}
}
示例5: getBoldFormat
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* @return the format to use for bold cells
* @throws WriteException if the format could not be created
*/
private WritableCellFormat getBoldFormat() throws WriteException {
WritableFont boldFont = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD);
WritableCellFormat boldHeading = new WritableCellFormat(boldFont);
boldHeading.setBorder(Border.BOTTOM, BorderLineStyle.MEDIUM);
boldHeading.setVerticalAlignment(VerticalAlignment.CENTRE);
boldHeading.setBackground(Colour.GRAY_25);
WritableCellFormat boldFormat = new WritableCellFormat(boldFont);
boldFormat.setVerticalAlignment(VerticalAlignment.TOP);
return boldFormat;
}
示例6: generateWriteableCellFormats
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
protected Map<CellFormat, WritableCellFormat> generateWriteableCellFormats(WritableCellFormat base) {
try {
WritableFont bold = new WritableFont(WritableFont.createFont(base.getFont().getName()),
base.getFont().getPointSize(), WritableFont.BOLD);
Map<CellFormat, WritableCellFormat> result = new HashMap<>();
for (boolean isCentered : new boolean[] { true, false }) {
for (boolean isBold : new boolean[] { true, false }) {
for (boolean hasTopBorder : new boolean[] { true, false }) {
CellFormat f = new CellFormat();
f.isCentered = isCentered;
f.isBold = isBold;
f.hasTopBorder = hasTopBorder;
WritableCellFormat format = new WritableCellFormat(base);
if (isCentered) format.setAlignment(Alignment.CENTRE);
if (isBold) format.setFont(bold);
if (hasTopBorder) format.setBorder(Border.TOP, BorderLineStyle.THIN);
result.put(f, format);
}
}
}
return result;
}
catch (WriteException e) { throw new RuntimeException(e); }
}
示例7: getFormat
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* @return the format1
*/
public WritableCellFormat getFormat() throws Exception{
// if(format==null){
format=new WritableCellFormat();
format.setAlignment(jxl.format.Alignment.LEFT);
format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
format.setBorder(Border.ALL, BorderLineStyle.THIN);
// }
return format;
}
示例8: getFormatRed
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* @return the formatRed
*/
public WritableCellFormat getFormatRed() throws Exception{
// if(formatRed == null){
formatRed=new WritableCellFormat();
formatRed.setAlignment(jxl.format.Alignment.CENTRE);
formatRed.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
WritableFont wf_color = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.RED);
WritableCellFormat wff_color = new WritableCellFormat(wf_color);
formatRed.setBorder(Border.ALL, BorderLineStyle.THIN);
formatRed.setFont(wf_color);
// }
return formatRed;
}
示例9: getFormatCenter
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* @return the formatCenter
*/
public WritableCellFormat getFormatCenter() throws Exception{
// if(formatCenter==null){
formatCenter=new WritableCellFormat();
formatCenter.setAlignment(jxl.format.Alignment.CENTRE);
formatCenter.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
formatCenter.setBorder(Border.ALL, BorderLineStyle.THIN);
// }
return formatCenter;
}
示例10: exportExcel
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/***************************************************************************
* @param <T>
* @param fileName EXCEL文件名称
* @param listTitle EXCEL文件第一行列标题集合
* @param listContent EXCEL文件正文数据集合
* @return
* @throws Exception
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> void exportExcel(String fileName, String[] Title, List<T> contents, WritingOneRowHandler writingHandler, HttpServletResponse response)
throws Exception {
OutputStream os = null;
os = response.getOutputStream();
response.reset();
response.setHeader("Content-disposition", "attachment; filename="+ new String(fileName.getBytes("GB2312"),"ISO8859-1"));
response.setContentType("application/msexcel");// 定义输出类型
/** **********创建工作表 ************ */
WritableWorkbook workbook = Workbook.createWorkbook(os);
/** **********创建工作表************ */
WritableSheet sheet = workbook.createSheet("虚机信息列表", 0);
/** **********设置纵横打印(默认为纵打)、打印纸***************** */
jxl.SheetSettings sheetset = sheet.getSettings();
sheetset.setProtected(false);
/** ************设置单元格字体************** */
WritableFont NormalFont = new WritableFont(WritableFont.COURIER, 10);
WritableFont BoldFont = new WritableFont(WritableFont.COURIER, 10,WritableFont.BOLD);
/** ************以下设置三种单元格样式,灵活备用************ */
// 用于标题居中
WritableCellFormat wcf_center = new WritableCellFormat(BoldFont);
wcf_center.setBorder(Border.ALL, BorderLineStyle.THIN); // 线条
wcf_center.setVerticalAlignment(VerticalAlignment.CENTRE); // 文字垂直对齐
wcf_center.setAlignment(Alignment.CENTRE); // 文字水平对齐
wcf_center.setWrap(false); // 文字是否换行
// 用于正文居左
WritableCellFormat wcf_left = new WritableCellFormat(NormalFont);
wcf_left.setBorder(Border.NONE, BorderLineStyle.THIN); // 线条
wcf_left.setVerticalAlignment(VerticalAlignment.CENTRE); // 文字垂直对齐
wcf_left.setAlignment(Alignment.LEFT); // 文字水平对齐
wcf_left.setWrap(true); // 文字是否换行
/** ***************以下是EXCEL第一行列标题********************* */
for (int col = 0; col < Title.length; col++) {
sheet.addCell(new Label(col, 0,Title[col], wcf_center));
}
/** ***************以下是EXCEL正文数据********************* */
int rowNo = 1;
for(T obj: contents){
writingHandler.write(obj, rowNo, sheet, wcf_left);
rowNo++;
}
/** **********将以上缓存中的内容写到EXCEL文件中******** */
workbook.write();
/** *********关闭文件************* */
workbook.close();
}
示例11: writeExcel
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> boolean writeExcel(File file, String[] Title, List<T> contents, @SuppressWarnings("rawtypes") WritingOneRowHandler writingHandler) {
try {
/** **********创建工作表 ************ */
WritableWorkbook workbook = Workbook.createWorkbook(file);
/** **********创建工作表************ */
WritableSheet sheet = workbook.createSheet("虚机信息列表", 0);
/** **********设置纵横打印(默认为纵打)、打印纸***************** */
jxl.SheetSettings sheetset = sheet.getSettings();
sheetset.setProtected(false);
/** ************设置单元格字体************** */
WritableFont NormalFont = new WritableFont(WritableFont.COURIER, 10);
WritableFont BoldFont = new WritableFont(WritableFont.COURIER, 10,WritableFont.BOLD);
/** ************以下设置三种单元格样式,灵活备用************ */
// 用于标题居中
WritableCellFormat wcf_center = new WritableCellFormat(BoldFont);
wcf_center.setBorder(Border.ALL, BorderLineStyle.THIN); // 线条
wcf_center.setVerticalAlignment(VerticalAlignment.CENTRE); // 文字垂直对齐
wcf_center.setAlignment(Alignment.CENTRE); // 文字水平对齐
wcf_center.setWrap(false); // 文字是否换行
// 用于正文居左
WritableCellFormat wcf_left = new WritableCellFormat(NormalFont);
wcf_left.setBorder(Border.NONE, BorderLineStyle.THIN); // 线条
wcf_left.setVerticalAlignment(VerticalAlignment.CENTRE); // 文字垂直对齐
wcf_left.setAlignment(Alignment.LEFT); // 文字水平对齐
wcf_left.setWrap(true); // 文字是否换行
/** ***************以下是EXCEL第一行列标题********************* */
for (int col = 0; col < Title.length; col++) {
sheet.addCell(new Label(col, 0,Title[col], wcf_center));
}
/** ***************以下是EXCEL正文数据********************* */
int rowNo = 1;
for(T obj: contents){
writingHandler.write(obj, rowNo, sheet, wcf_left);
rowNo++;
}
/** **********将以上缓存中的内容写到EXCEL文件中******** */
workbook.write();
/** *********关闭文件************* */
workbook.close();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
示例12: setParam
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
private WritableCellFormat setParam(WritableCellFormat wcf, int map) throws WriteException {
if ( (map&CENTRE)!=0 ) wcf.setAlignment(Alignment.CENTRE);
if ( (map&RIGHT)!=0 ) wcf.setAlignment(Alignment.RIGHT);
if ( (map&LEFT)!=0 ) wcf.setAlignment(Alignment.LEFT);
if ( (map&VCENTRE)!=0 ) wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
if ( (map&B_TOP_MED)!=0 ) wcf.setBorder(Border.TOP, BorderLineStyle.MEDIUM);
if ( (map&B_BOTTOM_MED)!=0 ) wcf.setBorder(Border.BOTTOM, BorderLineStyle.MEDIUM);
if ( (map&B_LEFT_MED)!=0 ) wcf.setBorder(Border.LEFT, BorderLineStyle.MEDIUM);
if ( (map&B_RIGHT_MED)!=0 ) wcf.setBorder(Border.RIGHT, BorderLineStyle.MEDIUM);
if ( (map&B_ALL_MED)!=0 ) {
wcf.setBorder(Border.RIGHT, BorderLineStyle.MEDIUM);
wcf.setBorder(Border.LEFT, BorderLineStyle.MEDIUM);
wcf.setBorder(Border.TOP, BorderLineStyle.MEDIUM);
wcf.setBorder(Border.BOTTOM, BorderLineStyle.MEDIUM);
}
if ( (map&B_TOP_LOW)!=0 ) wcf.setBorder(Border.TOP, BorderLineStyle.THIN);
if ( (map&B_BOTTOM_LOW)!=0 ) wcf.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
if ( (map&B_LEFT_LOW)!=0 ) wcf.setBorder(Border.LEFT, BorderLineStyle.THIN);
if ( (map&B_RIGHT_LOW)!=0 ) wcf.setBorder(Border.RIGHT, BorderLineStyle.THIN);
if ( (map&B_ALL_LOW)!=0 ) {
wcf.setBorder(Border.RIGHT, BorderLineStyle.THIN);
wcf.setBorder(Border.LEFT, BorderLineStyle.THIN);
wcf.setBorder(Border.TOP, BorderLineStyle.THIN);
wcf.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
}
if ( (map&GRAY_25)!=0 ) wcf.setBackground(Colour.GRAY_25);
if ( (map&GREEN)!=0 ) wcf.setBackground(Colour.LIGHT_GREEN);
if ( (map&BLACK)!=0 ) wcf.setBackground(Colour.BLACK);
if ( (map&YELLOW)!=0 ) wcf.setBackground(Colour.YELLOW);
if ( (map&RED)!=0 ) wcf.setBackground(Colour.RED);
if ( (map&WRAP)!=0 ) wcf.setWrap(true);
if ( (map&DIAG45)!=0 ) wcf.setOrientation(Orientation.PLUS_45);
return wcf;
}
示例13: generateExcelReport
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
public void generateExcelReport()
{
if(this.reports.isEmpty())
{
this.status = "There is no data yet";
this.success = false;
this.exception = "Please run linkcrawler at least once in order to be able to generate a report";
return;
}
try {
String reportDir = System.getProperty("user.dir") + File.separatorChar + "Reports";
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd__HH_mm_ss");
String reportDirFile = reportDir + File.separatorChar + "Report_" + dateFormat.format(date);
reportLocation = reportDirFile;
String reportExcelFile = reportDirFile + File.separatorChar + "ReportExcel.xls";
File reportDirPointer = new File(reportDir);
File reportDirFilePointer = new File(reportDirFile);
//Creating directories if not there
if(!reportDirFilePointer.exists())
{
reportDirPointer.mkdir();
reportDirFilePointer.mkdir();
}
File reportExcelFilePointer = new File(reportExcelFile);
reportExcelFilePointer.createNewFile();
WritableWorkbook workbook = Workbook.createWorkbook(reportExcelFilePointer);
int sheetNumber = 0;
for(UrlReport ur : reports)
{
WritableSheet sheet = workbook.createSheet("Crawled Url " + (sheetNumber + 1), sheetNumber++);
WritableFont blackHeadersFont = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.WHITE);
WritableCellFormat blackHeadersFormatBackground = new WritableCellFormat();
blackHeadersFormatBackground.setBackground(Colour.BLUE) ;
blackHeadersFormatBackground.setBorder(Border.ALL, BorderLineStyle.THIN,Colour.BLACK);
blackHeadersFormatBackground.setFont(blackHeadersFont);
blackHeadersFormatBackground.setAlignment(Alignment.LEFT);
WritableFont whiteValueFont = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
WritableCellFormat whiteValueFormatBackground = new WritableCellFormat();
whiteValueFormatBackground.setBackground(Colour.WHITE);
whiteValueFormatBackground.setBorder(Border.ALL, BorderLineStyle.THIN,Colour.BLACK);
whiteValueFormatBackground.setFont(whiteValueFont);
whiteValueFormatBackground.setAlignment(Alignment.LEFT);
Label introLabel = new Label(0, 0, "Site:", blackHeadersFormatBackground);
Label introLabelValue = new Label(1, 0, ur.getPageUrl()+" ", whiteValueFormatBackground);
sheet.addCell(introLabel);
sheet.addCell(introLabelValue);
int staringRow = 0;
staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.INTERNAL, "Internal links ", blackHeadersFormatBackground, whiteValueFormatBackground);
staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.EXTERNAL, "External links ", blackHeadersFormatBackground, whiteValueFormatBackground);
staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.SPECIAL, "Special links ", blackHeadersFormatBackground, whiteValueFormatBackground);
staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.IMAGES, "Images ", blackHeadersFormatBackground, whiteValueFormatBackground);
for(int x=0; x < sheet.getColumns(); x++)
{
CellView cell=sheet.getColumnView(x);
cell.setAutosize(true);
sheet.setColumnView(x, cell);
}
}
workbook.write();
workbook.close();
this.status = "Excel report generated";
} catch (Exception ex) {
this.status = "Error when generating Excel File";
this.success = false;
this.exception = ex.getMessage();
}
}
示例14: writeFooter
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
/**
* Write the average and sum formulas at the bottom of the table.
*
* @param rowNumber The row number for the row after the last row of the meetings.
* @param memberNames The names of each team member.
* @param sumMemberDurations The total speaking time per member, in seconds
* @param avgMemberDurations The average speaking time per member, in seconds
* @param totalMeetingDuration The total time of all meetings.
*/
private void writeFooter(int rowNumber, List<String> memberNames, Map<String, Integer> sumMemberDurations, Map<String, Integer> avgMemberDurations,
long totalMeetingDuration) {
try {
// Create formats we need for the bottom rows of the table.
WritableCellFormat boldTopBorderLabel = new WritableCellFormat(mBoldFormat);
boldTopBorderLabel.setBorder(Border.TOP, BorderLineStyle.DOUBLE);
WritableCellFormat boldTopBorderLongDuration = new WritableCellFormat(mLongDurationFormat);
boldTopBorderLongDuration.setFont(new WritableFont(mBoldFormat.getFont()));
boldTopBorderLongDuration.setBorder(Border.TOP, BorderLineStyle.DOUBLE);
WritableCellFormat boldShortDuration = new WritableCellFormat(mShortDurationFormat);
boldShortDuration.setFont(new WritableFont(mBoldFormat.getFont()));
// Insert the average and total titles.
insertCell(mContext.getString(R.string.member_list_header_sum_duration), rowNumber, 0, boldTopBorderLabel);
insertCell(mContext.getString(R.string.member_list_header_avg_duration), rowNumber + 1, 0, mBoldFormat);
int columnCount = memberNames.size() + 2;
// Insert the average and total durations for all members
for (int i = 0; i < memberNames.size(); i++) {
String memberName = memberNames.get(i);
int col = i + 1;
insertDurationCell(sumMemberDurations.get(memberName), rowNumber, col, boldTopBorderLongDuration);
insertDurationCell(avgMemberDurations.get(memberName), rowNumber + 1, col, boldShortDuration);
}
// Insert the average and total durations for the meetings.
insertDurationCell(totalMeetingDuration, rowNumber, columnCount - 1, boldTopBorderLongDuration);
int numMeetings = rowNumber - 1;
long averageMeetingDuration = numMeetings == 0 ? 0 : totalMeetingDuration / numMeetings;
insertDurationCell(averageMeetingDuration, rowNumber + 1, columnCount - 1, boldShortDuration);
// Now that the whole table is filled, auto-size the width of the first and last columns.
CellView columnView = mSheet.getColumnView(0);
columnView.setAutosize(true);
mSheet.setColumnView(0, columnView);
columnView = mSheet.getColumnView(columnCount - 1);
columnView.setAutosize(true);
mSheet.setColumnView(columnCount - 1, columnView);
} catch (JXLException e) {
Log.e(TAG, "Error adding formulas: " + e.getMessage(), e);
}
}
示例15: writeTo
import jxl.write.WritableCellFormat; //导入方法依赖的package包/类
private void writeTo( WritableWorkbook workbook, String sheetName, NList data ) throws WriteException {
WritableSheet sheet = workbook.createSheet( sheetName, workbook.getNumberOfSheets() );
// Write Header
WritableCellFormat headerCellFormat = new WritableCellFormat();
headerCellFormat.setBorder( Border.ALL, BorderLineStyle.THIN );
headerCellFormat.setBackground( Colour.GRAY_25 );
int column = 0;
for( String alias : data.getAliases() ) {
sheet.addCell( new Label( column++, 0, toExcelText( alias ), headerCellFormat ) );
}
// Write Body
WritableCellFormat bodyCellFormat = new WritableCellFormat();
bodyCellFormat.setBorder( Border.ALL, BorderLineStyle.THIN );
int rowCnt = data.size();
int colCnt = data.keySize();
for( int row = 0; row < rowCnt; row++ ) {
for( int col = 0; col < colCnt; col++ ) {
sheet.addCell( new Label( col, row + 1, toExcelText( data.get( data.getKey( col ), row ) ), bodyCellFormat ) );
}
}
}