本文整理汇总了Java中jxl.write.WritableFont.setColour方法的典型用法代码示例。如果您正苦于以下问题:Java WritableFont.setColour方法的具体用法?Java WritableFont.setColour怎么用?Java WritableFont.setColour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jxl.write.WritableFont
的用法示例。
在下文中一共展示了WritableFont.setColour方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: format
import jxl.write.WritableFont; //导入方法依赖的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();
}
}
示例2: format
import jxl.write.WritableFont; //导入方法依赖的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();
}
}
示例3: getHeader
import jxl.write.WritableFont; //导入方法依赖的package包/类
public static WritableCellFormat getHeader() {
WritableFont font = new WritableFont(WritableFont.TIMES, 10,
WritableFont.BOLD);// 定义字体
try {
font.setColour(Colour.BLUE);// 蓝色字体
} catch (WriteException e1) {
e1.printStackTrace();
}
WritableCellFormat format = new WritableCellFormat(font);
try {
format.setAlignment(jxl.format.Alignment.CENTRE);// 左右居中
format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 上下居中
// format.setBorder(Border.ALL, BorderLineStyle.THIN,
// Colour.BLACK);// 黑色边框
// format.setBackground(Colour.YELLOW);// 黄色背景
} catch (WriteException e) {
e.printStackTrace();
}
return format;
}
示例4: ExcelWriter
import jxl.write.WritableFont; //导入方法依赖的package包/类
/**
* ExcelWriter constructor.
* @param outputFile Excel 2003 output workbook.
* @throws IOException Unable to work with output location.
*/
public ExcelWriter(File outputFile) throws IOException
{
workbook = Workbook.createWorkbook(outputFile);
WritableFont font1 = new WritableFont(WritableFont.ARIAL, 10);
WritableFont font2= new WritableFont(WritableFont.ARIAL, 10);
WritableFont font3= new WritableFont(WritableFont.ARIAL, 10);
WritableFont defaultFont= new WritableFont(WritableFont.ARIAL, 10);
try {
font1.setColour(Colour.DARK_BLUE);
font1.setBoldStyle(WritableFont.BOLD);
font2.setBoldStyle(WritableFont.BOLD);
font2.setColour(Colour.RED);
font3.setColour(Colour.BLACK);
font3.setBoldStyle(WritableFont.BOLD);
}
catch (WriteException ex)
{
}
BoldBlue= new WritableCellFormat(font1);
BoldRed= new WritableCellFormat(font2);
BoldBlack= new WritableCellFormat(font3);
Default= new WritableCellFormat(defaultFont);
}
示例5: outputDataHeadings
import jxl.write.WritableFont; //导入方法依赖的package包/类
/**
* Outputs the data headings row.
*
* @param workSheet to add the row to
* @param table to fetch metadata from
* @param startRow to add the headings at
* @param helpTextRowNumbers - the map of column names to row index for each
* bit of help text
* @throws WriteException if any of the writes to workSheet failed
* @return the row to carry on inserting at
*/
private int outputDataHeadings(WritableSheet workSheet, Table table, final int startRow, final Map<String, Integer> helpTextRowNumbers) throws WriteException {
int currentRow = startRow;
int columnNumber = 0;
final WritableCellFormat columnHeadingFormat = getBoldFormat();
columnHeadingFormat.setBackground(Colour.VERY_LIGHT_YELLOW);
WritableFont font = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD);
font.setColour(Colour.BLUE);
font.setUnderlineStyle(UnderlineStyle.SINGLE);
columnHeadingFormat.setFont(font);
for (Column column : table.columns()) {
if(columnNumber < MAX_EXCEL_COLUMNS && !column.getName().equals("id") && !column.getName().equals("version")) {
// Data heading is a link back to the help text
WritableHyperlink linkToHelp = new WritableHyperlink(
columnNumber, currentRow,
spreadsheetifyName(column.getName()),
workSheet, 0, helpTextRowNumbers.get(column.getName()));
workSheet.addHyperlink(linkToHelp);
WritableCell label = workSheet.getWritableCell(columnNumber, currentRow);
label.setCellFormat(columnHeadingFormat);
// Update the help text such that it is a link to the heading
Cell helpCell = workSheet.getCell(0, helpTextRowNumbers.get(column.getName()));
WritableHyperlink linkFromHelp = new WritableHyperlink(
0, helpTextRowNumbers.get(column.getName()),
helpCell.getContents(),
workSheet, columnNumber, currentRow);
workSheet.addHyperlink(linkFromHelp);
columnNumber++;
}
}
currentRow++;
return currentRow;
}