本文整理汇总了Java中jxl.format.Colour.BLACK属性的典型用法代码示例。如果您正苦于以下问题:Java Colour.BLACK属性的具体用法?Java Colour.BLACK怎么用?Java Colour.BLACK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类jxl.format.Colour
的用法示例。
在下文中一共展示了Colour.BLACK属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: setXFBorder
/**
* 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;
}
示例3: getBorderColour
/**
* 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;
}
示例4: WritableFont
/**
* Creates a default font, vanilla font of the specified face and with
* default point size.
*
* @param fn the font name
*/
public WritableFont(FontName fn)
{
this(fn,
DEFAULT_POINT_SIZE,
NO_BOLD,
false,
UnderlineStyle.NO_UNDERLINE,
Colour.BLACK,
ScriptStyle.NORMAL_SCRIPT);
}
示例5: setBorder
/**
* 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);
}
示例6: generateExcelReport
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();
}
}
示例7: setBorder
/**
* Sets the specified border for this format
*
* @param b the border
* @param ls the border line style
* @exception jxl.write.WriteException
*/
public void setBorder(Border b, BorderLineStyle ls) throws WriteException
{
super.setBorder(b, ls, Colour.BLACK);
}