当前位置: 首页>>代码示例>>Java>>正文


Java WritableFont.NO_BOLD属性代码示例

本文整理汇总了Java中jxl.write.WritableFont.NO_BOLD属性的典型用法代码示例。如果您正苦于以下问题:Java WritableFont.NO_BOLD属性的具体用法?Java WritableFont.NO_BOLD怎么用?Java WritableFont.NO_BOLD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在jxl.write.WritableFont的用法示例。


在下文中一共展示了WritableFont.NO_BOLD属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIndex

/**
 * Create the index worksheet.
 *
 * <p>This also creates links back to the index in each of the worksheets.</p>
 */
public void createIndex() {
  WritableSheet sheet = workbook.createSheet(spreadsheetifyName("Index"), 0);
  createTitle(sheet, "Index");

  try {
    // Create links for each worksheet, apart from the first sheet which is the
    // index we're currently creating
    final String[] names = workbook.getSheetNames();
    for (int currentSheet = 1; currentSheet < names.length; currentSheet++) {
      // Create the link from the index to the table's worksheet
      WritableHyperlink link = new WritableHyperlink(0, currentSheet - 1 + NUMBER_OF_ROWS_IN_TITLE, names[currentSheet], workbook.getSheet(currentSheet), 0, 0);
      sheet.addHyperlink(link);

      //Add the filename in column B (stored in cell B2 of each sheet)
      String fileName = workbook.getSheet(currentSheet).getCell(1, 1).getContents();
      Label fileNameLabel = new Label(1, currentSheet - 1 + NUMBER_OF_ROWS_IN_TITLE, fileName);
      WritableFont fileNameFont = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
      WritableCellFormat fileNameFormat = new WritableCellFormat(fileNameFont);
      fileNameLabel.setCellFormat(fileNameFormat);
      sheet.addCell(fileNameLabel);

      // Create the link back to the index
      link = new WritableHyperlink(0, 1, "Back to index", sheet, 0, currentSheet + NUMBER_OF_ROWS_IN_TITLE - 1);
      workbook.getSheet(currentSheet).addHyperlink(link);
      //Set column A of each sheet to be wide enough to show "Back to index"
      workbook.getSheet(currentSheet).setColumnView(0, 13);
    }

    // Make Column A fairly wide to show tab names and hide column B
    sheet.setColumnView(0, 35);
    sheet.setColumnView(1, 0);

  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:41,代码来源:SpreadsheetDataSetConsumer.java

示例2: getFormatRed

/**
	 * @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;
	}
 
开发者ID:jview,项目名称:jtools,代码行数:16,代码来源:BaseExcel.java

示例3: updateFont

private void updateFont() {
	font = new WritableFont(fontName, fontSize, bold ? WritableFont.BOLD : WritableFont.NO_BOLD);
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:3,代码来源:ExcelCellFormat.java

示例4: createFileAndUpload

public static boolean createFileAndUpload(String merCode, String startDate, String endDate,String date,String date_hms){
	boolean fileFlag = false;
	try{
		List<MerFundStance> dataList = merFundStanceDAO.queryMerFundStanceDataLst(merCode, startDate, endDate);
		
		String basePath = "/var/www/apps/java/data/shls";
		
		File f1 = new File(basePath);
		if (!f1.exists()) {
			f1.mkdirs();
		}
		
		File f2 = new File(basePath + "/" + merCode);//判断基础路径下商户文件夹是否存在,若不存在则创建
		if (!f2.exists()) {
			f2.mkdirs();
		}
		
		File f = new File(basePath + "/" + merCode + "/" +date);//判断路径下日期文件夹是否存在,若不存在则创建
		if (!f.exists()) {
			f.mkdirs();
		}
		
		log.info("开始创建excel文件");
		log.info(pingJie.getStringPingJie("开始创建excel文件,全路径为:",basePath , "/" , merCode , "/" , date+ "/" , date_hms , "_shls.xls"));
		WritableWorkbook wbook = Workbook.createWorkbook(new File(basePath + "/" + merCode + "/" + date
				+ "/" + date_hms + "_shls.xls"));
		WritableSheet wsheet = wbook.createSheet("商户流水", 0);
		
		// 设置excel里的字体
		WritableFont wf = new WritableFont(WritableFont.ARIAL, 12,WritableFont.NO_BOLD, false);
		// 给标题规定字体的格式
		WritableCellFormat titleFormat = new WritableCellFormat(wf);
		
		Label excelTitle = new Label(0, 0, "商户号",titleFormat);
		wsheet.addCell(excelTitle);
		Label excelTitle1 = new Label(1, 0, "交易日期",titleFormat);
		wsheet.addCell(excelTitle1);
		Label excelTitle2 = new Label(2, 0, "交易金额",titleFormat);
		wsheet.addCell(excelTitle2);
		Label excelTitle3 = new Label(3, 0, "变动金额",titleFormat);
		wsheet.addCell(excelTitle3);
		Label excelTitle4 = new Label(4, 0, "账户余额",titleFormat);
		wsheet.addCell(excelTitle4);
		Label excelTitle5 = new Label(5, 0, "简短说明",titleFormat);
		wsheet.addCell(excelTitle5);
		
		if(dataList != null && dataList.size() > 0){
			int dataCount = 1;
			String tradeDate = null;
			String tradeTime = null;
			for (MerFundStance merFundStance : dataList) {
				Label excelTitle_mer_code = new Label(0, dataCount, merFundStance.getMerCode().getId(), titleFormat);
				wsheet.addCell(excelTitle_mer_code);
				tradeDate = merFundStance.getTradeTime().toString().substring(0, 10).replace("-", "");
				tradeTime = merFundStance.getTradeTime().toString().substring(11, 19).replace(":", "");
				Label excelTitle_trade_time = new Label(1, dataCount, tradeDate + tradeTime, titleFormat);
				wsheet.addCell(excelTitle_trade_time);
				Label excelTitle_mer_fee = new Label(2, dataCount, String.format("%.2f", merFundStance.getTradeAmount()), titleFormat);
				wsheet.addCell(excelTitle_mer_fee);
				Label excelTitle_change_amount = new Label(3, dataCount, String.format("%.2f", merFundStance.getChangeAmount()), titleFormat);
				wsheet.addCell(excelTitle_change_amount);
				Label excelTitle_account_amount = new Label(4, dataCount, String.format("%.2f", merFundStance.getAccountAmount()), titleFormat);
				wsheet.addCell(excelTitle_account_amount);
				Label excelTitle_derc_status = new Label(5, dataCount, cn.com.chinaebi.dz.object.util.DercStatusConvert.getDercStatus(merFundStance.getDercStatus()), titleFormat);
				wsheet.addCell(excelTitle_derc_status);
				dataCount ++;
			}
		}else{
			log.debug(pingJie.getStringPingJie("根据请求参数查询数据为空"));
		}
		// 写入文件
		wbook.write();
		wbook.close();
		fileFlag = true;
		log.info("文件创建成功");
	}catch(Exception e){
		log.error(e);
	}
	return fileFlag;
}
 
开发者ID:wufeisoft,项目名称:data,代码行数:80,代码来源:CreateMerFundStanceFileService.java

示例5: exportExcel

public static void exportExcel(String name, String[] head,
		String[][] content) throws Exception {
	// FileChooser
	JFileChooser chooser = new JFileChooser();
	chooser.setFileSelectionMode(JFileChooser.SAVE_DIALOG
			| JFileChooser.DIRECTORIES_ONLY);
	chooser.showDialog(null, null);
	File fi = chooser.getSelectedFile();
	if (fi == null) {
		return;
	} else {
		String f = fi.getAbsolutePath() + "/" + name;
		File file = new File(f);
		if (!file.exists()) {
			file.createNewFile();
		}

		WritableWorkbook book = Workbook.createWorkbook(file);
		WritableSheet sheet = book.createSheet("第一页", 0);
		SheetSettings setting = sheet.getSettings();
		setting.setVerticalFreeze(1);

		// 第一行字体
		WritableFont headFont = new WritableFont(
				WritableFont.createFont("微软雅黑"), 10, WritableFont.BOLD);
		WritableCellFormat headF = new WritableCellFormat(headFont);
		headF.setAlignment(Alignment.CENTRE); // 平行居中
		headF.setVerticalAlignment(VerticalAlignment.CENTRE); // 垂直居中

		// 表格内容字体
		WritableFont contentFont = new WritableFont(
				WritableFont.createFont("微软雅黑"), 9, WritableFont.NO_BOLD);
		WritableCellFormat contentF = new WritableCellFormat(contentFont);
		contentF.setAlignment(Alignment.CENTRE); // 平行居中
		contentF.setVerticalAlignment(VerticalAlignment.CENTRE); // 垂直居中

		int column = head.length;
		// 不包括头
		int row = content.length;

		for (int i = 0; i < column; i++)
			sheet.addCell(new Label(i, 0, head[i], headF));
		for (int i = 0; i < row; i++)
			for (int j = 0; j < column; j++)
				sheet.addCell(new Label(j, i + 1, content[i][j], contentF));

		book.write();
		book.close();

		 JOptionPane.showMessageDialog(null, "导出excel成功辣!", "提示",
		 JOptionPane.CLOSED_OPTION);
	}

}
 
开发者ID:Disguiser-w,项目名称:SE2,代码行数:54,代码来源:FileExporter.java


注:本文中的jxl.write.WritableFont.NO_BOLD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。