當前位置: 首頁>>代碼示例>>Java>>正文


Java WritableFont.setColour方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:HowieTianDev,項目名稱:ChenYan,代碼行數:28,代碼來源:ExcelUtils.java

示例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();
    }
}
 
開發者ID:qiu-yongheng,項目名稱:Bluetooth_BLE,代碼行數:22,代碼來源:ExcelUtils.java

示例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;
}
 
開發者ID:reallin,項目名稱:Android_Excel,代碼行數:21,代碼來源:ExcelUtil.java

示例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);
}
 
開發者ID:kbakhit,項目名稱:RuleSet_Library,代碼行數:31,代碼來源:ExcelWriter.java

示例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;
}
 
開發者ID:alfasoftware,項目名稱:morf,代碼行數:52,代碼來源:TableOutputter.java


注:本文中的jxl.write.WritableFont.setColour方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。