本文整理汇总了Java中jxl.format.Border类的典型用法代码示例。如果您正苦于以下问题:Java Border类的具体用法?Java Border怎么用?Java Border使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Border类属于jxl.format包,在下文中一共展示了Border类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setExcelListTitle
import jxl.format.Border; //导入依赖的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();
}
}
示例2: setExcelListTitle
import jxl.format.Border; //导入依赖的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();
}
}
示例3: getBorder
import jxl.format.Border; //导入依赖的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());
}
示例4: getCellFormat
import jxl.format.Border; //导入依赖的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;
}
示例5: hasBorderBottom
import jxl.format.Border; //导入依赖的package包/类
private boolean hasBorderBottom(final Cell cell) {
if(cell == null) {
return false;
}
final CellFormat style = cell.getCellFormat();
if(style == null) {
return false;
}
if(style.getBorder(Border.BOTTOM).equals(Border.NONE)) {
return false;
}
return true;
}
示例6: ExportExcelUtil
import jxl.format.Border; //导入依赖的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);
}
示例7: getBoldFormat
import jxl.format.Border; //导入依赖的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;
}
示例8: generateWriteableCellFormats
import jxl.format.Border; //导入依赖的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); }
}
示例9: getFormat
import jxl.format.Border; //导入依赖的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;
}
示例10: getFormatRed
import jxl.format.Border; //导入依赖的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;
}
示例11: getFormatCenter
import jxl.format.Border; //导入依赖的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;
}
示例12: setXFBorder
import jxl.format.Border; //导入依赖的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;
}
示例13: getBorderLine
import jxl.format.Border; //导入依赖的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;
}
示例14: getBorderColour
import jxl.format.Border; //导入依赖的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 Colour getBorderColour(Border border)
{
// Don't bother with the short cut records
if (border == Border.NONE ||
border == Border.ALL)
{
return Colour.PALETTE_BLACK;
}
if (!formatInfoInitialized)
{
initializeFormatInformation();
}
if (border == Border.LEFT)
{
return leftBorderColour;
}
else if (border == Border.RIGHT)
{
return rightBorderColour;
}
else if (border == Border.TOP)
{
return topBorderColour;
}
else if (border == Border.BOTTOM)
{
return bottomBorderColour;
}
return Colour.BLACK;
}
示例15: setBorder
import jxl.format.Border; //导入依赖的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);
}