本文整理汇总了Java中jxl.format.UnderlineStyle类的典型用法代码示例。如果您正苦于以下问题:Java UnderlineStyle类的具体用法?Java UnderlineStyle怎么用?Java UnderlineStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnderlineStyle类属于jxl.format包,在下文中一共展示了UnderlineStyle类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setExcelListTitle
import jxl.format.UnderlineStyle; //导入依赖的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: setReportTitle
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* 设置报表标题
*
* @param reportTitle
* 报表标题
* @throws IOException
* @throws WriteException
* @throws WriteException
*/
public void setReportTitle(String reportTitle) throws WriteException, IOException {
try {
irow++;
wfont = new WritableFont(WritableFont.createFont("宋体"), 12, WritableFont.BOLD, false,
UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLACK);
wcfFC = new WritableCellFormat(wfont);
wcfFC.setAlignment(Alignment.CENTRE);// 对齐方式
// wcfFC.setBackground(jxl.format.Colour.VERY_LIGHT_YELLOW);// 背景色
wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);// 对齐方式
// wcfFC.setBorder(Border.ALL, BorderLineStyle.MEDIUM,
// Colour.BLACK);//
// 边框
wsheet.addCell(new Label(icol, irow, reportTitle, wcfFC));
trow = irow;
} catch (Exception e) {
this.close();
}
}
示例3: setExcelListTitle
import jxl.format.UnderlineStyle; //导入依赖的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();
}
}
示例4: getUnderlineStyle
import jxl.format.UnderlineStyle; //导入依赖的package包/类
public static UnderlineStyle getUnderlineStyle(int stepValue)
{
UnderlineStyle underline= UnderlineStyle.NO_UNDERLINE;
switch(stepValue)
{
case ExcelOutputMeta.FONT_UNDERLINE_SINGLE:
underline=UnderlineStyle.SINGLE;
break;
case ExcelOutputMeta.FONT_UNDERLINE_SINGLE_ACCOUNTING:
underline=UnderlineStyle.SINGLE_ACCOUNTING;
break;
case ExcelOutputMeta.FONT_UNDERLINE_DOUBLE:
underline=UnderlineStyle.DOUBLE;
break;
case ExcelOutputMeta.FONT_UNDERLINE_DOUBLE_ACCOUNTING:
underline=UnderlineStyle.DOUBLE_ACCOUNTING;
break;
default: break;
}
return underline;
}
示例5: getUnderlineStyle
import jxl.format.UnderlineStyle; //导入依赖的package包/类
public static UnderlineStyle getUnderlineStyle( int stepValue ) {
UnderlineStyle underline = UnderlineStyle.NO_UNDERLINE;
switch ( stepValue ) {
case ExcelOutputMeta.FONT_UNDERLINE_SINGLE:
underline = UnderlineStyle.SINGLE;
break;
case ExcelOutputMeta.FONT_UNDERLINE_SINGLE_ACCOUNTING:
underline = UnderlineStyle.SINGLE_ACCOUNTING;
break;
case ExcelOutputMeta.FONT_UNDERLINE_DOUBLE:
underline = UnderlineStyle.DOUBLE;
break;
case ExcelOutputMeta.FONT_UNDERLINE_DOUBLE_ACCOUNTING:
underline = UnderlineStyle.DOUBLE_ACCOUNTING;
break;
default:
break;
}
return underline;
}
示例6: createIndex
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* 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);
}
}
示例7: getFormatRed
import jxl.format.UnderlineStyle; //导入依赖的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;
}
示例8: WritableFont
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* 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);
}
示例9: outputDataHeadings
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* Outputs the data headings row.
*
* @param workSheet to add the row to
* @param table to fetch metadata from
* @param startRow to add the headings at
* @param helpTextRowNumbers - the map of column names to row index for each
* bit of help text
* @throws WriteException if any of the writes to workSheet failed
* @return the row to carry on inserting at
*/
private int outputDataHeadings(WritableSheet workSheet, Table table, final int startRow, final Map<String, Integer> helpTextRowNumbers) throws WriteException {
int currentRow = startRow;
int columnNumber = 0;
final WritableCellFormat columnHeadingFormat = getBoldFormat();
columnHeadingFormat.setBackground(Colour.VERY_LIGHT_YELLOW);
WritableFont font = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD);
font.setColour(Colour.BLUE);
font.setUnderlineStyle(UnderlineStyle.SINGLE);
columnHeadingFormat.setFont(font);
for (Column column : table.columns()) {
if(columnNumber < MAX_EXCEL_COLUMNS && !column.getName().equals("id") && !column.getName().equals("version")) {
// Data heading is a link back to the help text
WritableHyperlink linkToHelp = new WritableHyperlink(
columnNumber, currentRow,
spreadsheetifyName(column.getName()),
workSheet, 0, helpTextRowNumbers.get(column.getName()));
workSheet.addHyperlink(linkToHelp);
WritableCell label = workSheet.getWritableCell(columnNumber, currentRow);
label.setCellFormat(columnHeadingFormat);
// Update the help text such that it is a link to the heading
Cell helpCell = workSheet.getCell(0, helpTextRowNumbers.get(column.getName()));
WritableHyperlink linkFromHelp = new WritableHyperlink(
0, helpTextRowNumbers.get(column.getName()),
helpCell.getContents(),
workSheet, columnNumber, currentRow);
workSheet.addHyperlink(linkFromHelp);
columnNumber++;
}
}
currentRow++;
return currentRow;
}
示例10: generateExcelReport
import jxl.format.UnderlineStyle; //导入依赖的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();
}
}
示例11: Font
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* Creates a font of the specified face, point size, bold weight,
* italicisation and underline style
*
* @param ps the point size
* @param bs the bold style
* @param us underscore flag
* @param fn font name
* @param it italic flag
* @deprecated use jxl.write.WritableFont
*/
public Font(FontName fn,
int ps,
BoldStyle bs,
boolean it,
UnderlineStyle us)
{
super(fn, ps, bs, it, us);
}
示例12: getUnderlineStyle
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* Gets the underline style for this font
*
* @return the underline style
*/
public UnderlineStyle getUnderlineStyle()
{
return UnderlineStyle.getStyle(underlineStyle);
}
示例13: setUnderlineStyle
import jxl.format.UnderlineStyle; //导入依赖的package包/类
/**
* Sets the underline style for this font, if the font hasn't been
* initialized
*
* @param us the underline style
* @exception WriteException, if this font is already in use elsewhere
*/
public void setUnderlineStyle(UnderlineStyle us) throws WriteException
{
super.setUnderlineStyle(us.getValue());
}