Java Code Examples for jxl.write.WritableFont#TIMES

The following examples show how to use jxl.write.WritableFont#TIMES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExcelFontMap.java    From hop with Apache License 2.0 6 votes vote down vote up
public static FontName getFontName( int transformValue ) {

    FontName headerFontName = WritableFont.ARIAL;
    switch ( transformValue ) {
      case ExcelOutputMeta.FONT_NAME_COURIER:
        headerFontName = WritableFont.COURIER;
        break;
      case ExcelOutputMeta.FONT_NAME_TAHOMA:
        headerFontName = WritableFont.TAHOMA;
        break;
      case ExcelOutputMeta.FONT_NAME_TIMES:
        headerFontName = WritableFont.TIMES;
        break;
      default:
        break;
    }

    return headerFontName;
  }
 
Example 2
Source File: ExcelUtil.java    From Android_Excel with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: ExcelFontMap.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static FontName getFontName( int stepValue ) {

    FontName headerFontName = WritableFont.ARIAL;
    switch ( stepValue ) {
      case ExcelOutputMeta.FONT_NAME_COURIER:
        headerFontName = WritableFont.COURIER;
        break;
      case ExcelOutputMeta.FONT_NAME_TAHOMA:
        headerFontName = WritableFont.TAHOMA;
        break;
      case ExcelOutputMeta.FONT_NAME_TIMES:
        headerFontName = WritableFont.TIMES;
        break;
      default:
        break;
    }

    return headerFontName;
  }
 
Example 4
Source File: WriteExcel.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
private void createLabel(WritableSheet sheet)
        throws WriteException {
    // Create a times font
    WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);
    // Define the cell format
    times = new WritableCellFormat(times10pt);
    // Lets automatically wrap the cells
    times.setWrap(true);

    // create create a bold font with unterlines
    WritableFont times10ptBoldUnderline = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false,
            UnderlineStyle.SINGLE);
    timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);
    // Lets automatically wrap the cells
    timesBoldUnderline.setWrap(true);

    CellView cv = new CellView();
    cv.setFormat(times);
    cv.setFormat(timesBoldUnderline);
    cv.setAutosize(true);

    // Write a few headers
    addCaption(sheet, 0, 0, "Writer");
    addCaption(sheet, 1, 0, "Date");
    addCaption(sheet, 2, 0, "Guide");
    addCaption(sheet, 3, 0, "Description");
    addCaption(sheet, 4, 0, "Status");
}