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


Java BorderLineStyle类代码示例

本文整理汇总了Java中jxl.format.BorderLineStyle的典型用法代码示例。如果您正苦于以下问题:Java BorderLineStyle类的具体用法?Java BorderLineStyle怎么用?Java BorderLineStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCellFormat

import jxl.format.BorderLineStyle; //导入依赖的package包/类
/**
 * 通用的样式设置
 *
 * @param format    单元格样式
 * @param alignment 水平对齐方式
 * @return 通用的样式设置
 */
private static WritableCellFormat getCellFormat(WritableCellFormat format, Alignment alignment) {

    try {
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setAlignment(alignment);
        format.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
        format.setBorder(Border.LEFT, BorderLineStyle.THIN);
        format.setBorder(Border.RIGHT, BorderLineStyle.THIN);
        format.setBorder(Border.TOP, BorderLineStyle.THIN);
    } catch (WriteException e) {
        return format;
    }
    return format;

}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:23,代码来源:ExportUtil.java

示例2: setExcelListTitle

import jxl.format.BorderLineStyle; //导入依赖的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();
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:29,代码来源:DownloadExcelUtil.java

示例3: setExcelListTitle

import jxl.format.BorderLineStyle; //导入依赖的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();
    }
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:29,代码来源:DownloadExcelUtil.java

示例4: getBorder

import jxl.format.BorderLineStyle; //导入依赖的package包/类
public WBorderLineStyle getBorder(WBorder border) {
	BorderLineStyle borderLineStyle = null;
	if (WBorder.ALL.equals(border)) {
		borderLineStyle = format.getBorder(Border.ALL);
	} else if (WBorder.BOTTOM.equals(border)) {
		borderLineStyle = format.getBorder(Border.BOTTOM);
	} else if (WBorder.LEFT.equals(border)) {
		borderLineStyle = format.getBorder(Border.LEFT);
	} else if (WBorder.NONE.equals(border)) {
		borderLineStyle = format.getBorder(Border.NONE);
	} else if (WBorder.RIGHT.equals(border)) {
		borderLineStyle = format.getBorder(Border.RIGHT);
	} else if (WBorder.TOP.equals(border)) {
		borderLineStyle = format.getBorder(Border.TOP);
	}
	if (borderLineStyle == null) {
		throw new IllegalArgumentException("Not support border style.");
	}
	return new WBorderLineStyle(borderLineStyle.getValue(), borderLineStyle.getDescription());
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:21,代码来源:JxlWCellFormatImpl.java

示例5: ExportExcelUtil

import jxl.format.BorderLineStyle; //导入依赖的package包/类
public ExportExcelUtil() throws WriteException {

		titleFormat.setBorder(Border.ALL, BorderLineStyle.THIN); // 线条
		titleFormat.setVerticalAlignment(VerticalAlignment.CENTRE);

		titleFormat.setAlignment(Alignment.CENTRE); // 文字对齐
		titleFormat.setWrap(false); // 文字是否换行

		contentCenterFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
		contentCenterFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
		contentCenterFormat.setAlignment(Alignment.CENTRE);
		contentCenterFormat.setWrap(false);

		contentRightFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
		contentRightFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
		contentRightFormat.setAlignment(Alignment.RIGHT);
		contentRightFormat.setWrap(false);
	}
 
开发者ID:giantray,项目名称:ExcelTool,代码行数:19,代码来源:ExportExcelUtil.java

示例6: hasBorders

import jxl.format.BorderLineStyle; //导入依赖的package包/类
/**
 * Determines if this cell format has any borders at all.  Used to
 * set the new borders when merging a group of cells
 *
 * @return TRUE if this cell has any borders, FALSE otherwise
 */
public final boolean hasBorders()
{
  if (!formatInfoInitialized)
  {
    initializeFormatInformation();
  }

  if (leftBorder   == BorderLineStyle.NONE &&
      rightBorder  == BorderLineStyle.NONE &&
      topBorder    == BorderLineStyle.NONE &&
      bottomBorder == BorderLineStyle.NONE)
  {
    return false;
  }

  return true;
}
 
开发者ID:loginus,项目名称:jexcelapi,代码行数:24,代码来源:XFRecord.java

示例7: getBoldFormat

import jxl.format.BorderLineStyle; //导入依赖的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;
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:17,代码来源:TableOutputter.java

示例8: generateWriteableCellFormats

import jxl.format.BorderLineStyle; //导入依赖的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); }
}
 
开发者ID:onestopconcept,项目名称:onestop-endpoints,代码行数:28,代码来源:ExcelGenerator.java

示例9: getFormat

import jxl.format.BorderLineStyle; //导入依赖的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;
	}
 
开发者ID:jview,项目名称:jtools,代码行数:14,代码来源:BaseExcel.java

示例10: getFormatRed

import jxl.format.BorderLineStyle; //导入依赖的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;
	}
 
开发者ID:jview,项目名称:jtools,代码行数:17,代码来源:BaseExcel.java

示例11: getFormatCenter

import jxl.format.BorderLineStyle; //导入依赖的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;
	}
 
开发者ID:jview,项目名称:jtools,代码行数:14,代码来源:BaseExcel.java

示例12: setXFBorder

import jxl.format.BorderLineStyle; //导入依赖的package包/类
/**
 * Sets the border for this cell
 * This method should only be called from its writable subclass
 * CellXFRecord
 *
 * @param b the border
 * @param ls the border line style
 */
protected void setXFBorder(Border b, BorderLineStyle ls, Colour c)
{
  Assert.verify(!initialized);
  
  if (c == Colour.BLACK || c == Colour.UNKNOWN) 
  {
    c = Colour.PALETTE_BLACK;
  }

  if (b == Border.LEFT)
  {
    leftBorder = ls;
    leftBorderColour = c;
  }
  else if (b == Border.RIGHT)
  {
    rightBorder = ls;
    rightBorderColour = c;
  }
  else if (b == Border.TOP)
  {
    topBorder = ls;
    topBorderColour = c;
  }
  else if (b == Border.BOTTOM)
  {
    bottomBorder = ls;
    bottomBorderColour = c;
  }

  usedAttributes |= USE_BORDER;

  return;
}
 
开发者ID:loginus,项目名称:jexcelapi,代码行数:43,代码来源:XFRecord.java

示例13: getBorderLine

import jxl.format.BorderLineStyle; //导入依赖的package包/类
/**
 * Gets the line style for the given cell border
 * If a border type of ALL or NONE is specified, then a line style of
 * NONE is returned
 *
 * @param border the cell border we are interested in
 * @return the line style of the specified border
 */
public BorderLineStyle getBorderLine(Border border)
{
  // Don't bother with the short cut records
  if (border == Border.NONE ||
      border == Border.ALL)
  {
    return BorderLineStyle.NONE;
  }

  if (!formatInfoInitialized)
  {
    initializeFormatInformation();
  }

  if (border == Border.LEFT)
  {
    return leftBorder;
  }
  else if (border == Border.RIGHT)
  {
    return rightBorder;
  }
  else if (border == Border.TOP)
  {
    return topBorder;
  }
  else if (border == Border.BOTTOM)
  {
    return bottomBorder;
  }

  return BorderLineStyle.NONE;
}
 
开发者ID:loginus,项目名称:jexcelapi,代码行数:42,代码来源:XFRecord.java

示例14: setBorder

import jxl.format.BorderLineStyle; //导入依赖的package包/类
/**
 * Sets the border style for cells with this format
 * 
 * @exception WriteException 
 * @param b the border
 * @param ls the line for the specified border
 */
public void setBorder(Border b, BorderLineStyle ls, Colour c) 
  throws WriteException
{
  if (isInitialized())
  {
    throw new JxlWriteException(JxlWriteException.formatInitialized);
  }

  if (b == Border.ALL)
  {
    // Apply to all
    super.setXFBorder(Border.LEFT, ls, c);
    super.setXFBorder(Border.RIGHT, ls, c);
    super.setXFBorder(Border.TOP, ls, c);
    super.setXFBorder(Border.BOTTOM, ls, c);
    return;
  }

  if (b == Border.NONE)
  {
    // Apply to all
    super.setXFBorder(Border.LEFT,   BorderLineStyle.NONE, Colour.BLACK);
    super.setXFBorder(Border.RIGHT,  BorderLineStyle.NONE, Colour.BLACK);
    super.setXFBorder(Border.TOP,    BorderLineStyle.NONE, Colour.BLACK);
    super.setXFBorder(Border.BOTTOM, BorderLineStyle.NONE, Colour.BLACK);
    return;
  }

  super.setXFBorder(b, ls, c);
}
 
开发者ID:loginus,项目名称:jexcelapi,代码行数:38,代码来源:CellXFRecord.java

示例15: exportExcel

import jxl.format.BorderLineStyle; //导入依赖的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();   
 }
 
开发者ID:shuqin,项目名称:ALLIN,代码行数:66,代码来源:ExcelUtils.java


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