• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BorderLineStyle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例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;
        log.info("title use time:" + (System.currentTimeMillis() - start));
    } catch (Exception e) {
        this.close();
    }
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:29,代码来源:DownloadExcelUtil.java


示例3: 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


示例4: 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


示例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


示例16: writeExcel

import jxl.format.BorderLineStyle; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> boolean writeExcel(File file, String[] Title, List<T> contents, @SuppressWarnings("rawtypes") WritingOneRowHandler writingHandler) {

	  try {    

		   /** **********创建工作表 ************ */
		   WritableWorkbook workbook = Workbook.createWorkbook(file);

		   /** **********创建工作表************ */

		   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();   

	  } catch (Exception e) {
		  e.printStackTrace();
	      return false;
	  } 
	  return true;
 }
 
开发者ID:shuqin,项目名称:ALLIN,代码行数:59,代码来源:ExcelUtils.java


示例17: setParam

import jxl.format.BorderLineStyle; //导入依赖的package包/类
private WritableCellFormat setParam(WritableCellFormat wcf, int map) throws WriteException {
	if ( (map&CENTRE)!=0 ) 		wcf.setAlignment(Alignment.CENTRE);
	if ( (map&RIGHT)!=0 ) 		wcf.setAlignment(Alignment.RIGHT);
	if ( (map&LEFT)!=0 ) 		wcf.setAlignment(Alignment.LEFT);
	if ( (map&VCENTRE)!=0 ) 	wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
	
	if ( (map&B_TOP_MED)!=0 ) 	wcf.setBorder(Border.TOP, BorderLineStyle.MEDIUM);
	if ( (map&B_BOTTOM_MED)!=0 ) wcf.setBorder(Border.BOTTOM, BorderLineStyle.MEDIUM);
	if ( (map&B_LEFT_MED)!=0 ) 	wcf.setBorder(Border.LEFT, BorderLineStyle.MEDIUM);
	if ( (map&B_RIGHT_MED)!=0 ) wcf.setBorder(Border.RIGHT, BorderLineStyle.MEDIUM);
	
	if ( (map&B_ALL_MED)!=0 ) {
		wcf.setBorder(Border.RIGHT, BorderLineStyle.MEDIUM);
		wcf.setBorder(Border.LEFT, BorderLineStyle.MEDIUM);
		wcf.setBorder(Border.TOP, BorderLineStyle.MEDIUM);
		wcf.setBorder(Border.BOTTOM, BorderLineStyle.MEDIUM);
	}
	
	if ( (map&B_TOP_LOW)!=0 ) 	wcf.setBorder(Border.TOP, BorderLineStyle.THIN);
	if ( (map&B_BOTTOM_LOW)!=0 ) wcf.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
	if ( (map&B_LEFT_LOW)!=0 ) 	wcf.setBorder(Border.LEFT, BorderLineStyle.THIN);
	if ( (map&B_RIGHT_LOW)!=0 ) wcf.setBorder(Border.RIGHT, BorderLineStyle.THIN);
	
	if ( (map&B_ALL_LOW)!=0 ) {
		wcf.setBorder(Border.RIGHT, BorderLineStyle.THIN);
		wcf.setBorder(Border.LEFT, BorderLineStyle.THIN);
		wcf.setBorder(Border.TOP, BorderLineStyle.THIN);
		wcf.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
	}
	
	if ( (map&GRAY_25)!=0 ) wcf.setBackground(Colour.GRAY_25);
	if ( (map&GREEN)!=0 ) wcf.setBackground(Colour.LIGHT_GREEN);
	if ( (map&BLACK)!=0 ) wcf.setBackground(Colour.BLACK);
	if ( (map&YELLOW)!=0 ) wcf.setBackground(Colour.YELLOW);
	if ( (map&RED)!=0 ) wcf.setBackground(Colour.RED);
	
	if ( (map&WRAP)!=0 ) wcf.setWrap(true);
	
	if ( (map&DIAG45)!=0 ) wcf.setOrientation(Orientation.PLUS_45);
	

	
	return wcf;
}
 
开发者ID:vagfed,项目名称:hmcScanner,代码行数:45,代码来源:Loader.java


示例18: generateExcelReport

import jxl.format.BorderLineStyle; //导入依赖的package包/类
public void generateExcelReport()
{
    if(this.reports.isEmpty())
        {
            this.status = "There is no data yet";
            this.success = false;
            this.exception = "Please run linkcrawler at least once in order to be able to generate a report";
            return;
        }
    try {            
        String reportDir = System.getProperty("user.dir") + File.separatorChar + "Reports";
        Date date = new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd__HH_mm_ss");
        String reportDirFile = reportDir + File.separatorChar + "Report_" + dateFormat.format(date);
        reportLocation = reportDirFile;            
        String reportExcelFile = reportDirFile + File.separatorChar + "ReportExcel.xls";            
        File reportDirPointer = new File(reportDir);
        File reportDirFilePointer = new File(reportDirFile);            
        //Creating directories if not there
        if(!reportDirFilePointer.exists())
        {
            reportDirPointer.mkdir();
            reportDirFilePointer.mkdir();                
        }
        File reportExcelFilePointer = new File(reportExcelFile);
        reportExcelFilePointer.createNewFile();            
        WritableWorkbook workbook = Workbook.createWorkbook(reportExcelFilePointer);            
        int sheetNumber = 0;
        for(UrlReport ur : reports)
        {
            WritableSheet sheet = workbook.createSheet("Crawled Url " + (sheetNumber + 1), sheetNumber++);
            WritableFont blackHeadersFont = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.WHITE);
            WritableCellFormat blackHeadersFormatBackground = new WritableCellFormat();
            blackHeadersFormatBackground.setBackground(Colour.BLUE) ;
            blackHeadersFormatBackground.setBorder(Border.ALL, BorderLineStyle.THIN,Colour.BLACK);
            blackHeadersFormatBackground.setFont(blackHeadersFont);
            blackHeadersFormatBackground.setAlignment(Alignment.LEFT);
            WritableFont whiteValueFont = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            WritableCellFormat whiteValueFormatBackground = new WritableCellFormat();
            whiteValueFormatBackground.setBackground(Colour.WHITE);
            whiteValueFormatBackground.setBorder(Border.ALL, BorderLineStyle.THIN,Colour.BLACK);
            whiteValueFormatBackground.setFont(whiteValueFont);
            whiteValueFormatBackground.setAlignment(Alignment.LEFT);
            Label introLabel = new Label(0, 0, "Site:", blackHeadersFormatBackground);
            Label introLabelValue = new Label(1, 0, ur.getPageUrl()+"         ", whiteValueFormatBackground);
            sheet.addCell(introLabel);
            sheet.addCell(introLabelValue);  
            int staringRow = 0;                
            staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.INTERNAL, "Internal links   ", blackHeadersFormatBackground, whiteValueFormatBackground);
            staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.EXTERNAL, "External links   ", blackHeadersFormatBackground, whiteValueFormatBackground);
            staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.SPECIAL, "Special links   ", blackHeadersFormatBackground, whiteValueFormatBackground);
            staringRow = prepareLinksDataDetail(sheet, ur, staringRow, LinkTypes.IMAGES, "Images   ", blackHeadersFormatBackground, whiteValueFormatBackground);
             for(int x=0; x < sheet.getColumns(); x++)
            {
                CellView cell=sheet.getColumnView(x);
                cell.setAutosize(true);
                sheet.setColumnView(x, cell);
            }                
        }       
        workbook.write(); 
        workbook.close();
        this.status = "Excel report generated";
    } catch (Exception ex) {
        this.status = "Error when generating Excel File";
        this.success = false;
        this.exception = ex.getMessage();
    }
}
 
开发者ID:fanghon,项目名称:webmonitor,代码行数:69,代码来源:ReportController.java


示例19: BaseEditorSupporter

import jxl.format.BorderLineStyle; //导入依赖的package包/类
public BaseEditorSupporter() {
	try {
		// defFormat
		defFormat.setAlignment(Alignment.LEFT);
		defFormat.setVerticalAlignment(VerticalAlignment.TOP);
		defFont.setColour(Colour.GRAY_50);
		defFormat.setFont(defFont);

		// headFormat
		headerFormat.setBackground(Colour.ICE_BLUE);
		headerFormat.setAlignment(Alignment.CENTRE);
		headerFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
		headerFormat.setWrap(true);
		headerFormat.setVerticalAlignment(VerticalAlignment.TOP);
		// headFont.setColour(Colour.WHITE);
		headerFormat.setFont(headerFont);

		// numberFormat
		numberFormat.setAlignment(Alignment.RIGHT);
		numberFormat.setVerticalAlignment(VerticalAlignment.TOP);
		numberFormat.setFont(numberFont);

		// stringFormat
		stringFormat.setAlignment(Alignment.LEFT);
		stringFormat.setWrap(true);
		stringFormat.setVerticalAlignment(VerticalAlignment.TOP);
		stringFormat.setFont(stringFont);

		// booleanFormat
		booleanFormat.setAlignment(Alignment.LEFT);
		booleanFormat.setVerticalAlignment(VerticalAlignment.TOP);
		booleanFormat.setFont(booleanFont);

		// dateFormat
		dateFormat.setAlignment(Alignment.LEFT);
		dateFormat.setVerticalAlignment(VerticalAlignment.TOP);
		dateFormat.setFont(dateFont);
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:42,代码来源:BaseEditorSupporter.java


示例20: discover

import jxl.format.BorderLineStyle; //导入依赖的package包/类
public BorderLineStyle discover(eu.ggnet.lucidcalc.CBorder.LineStyle lineStyle) {
    if ( lineStyle == null ) return BorderLineStyle.NONE;
    // This just works, because I use the same order.
    return BorderLineStyle.getStyle(lineStyle.ordinal());
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:6,代码来源:FormatUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HFileCorruptionChecker类代码示例发布时间:2022-05-21
下一篇:
Java WicketFilter类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap