Java Code Examples for jxl.format.UnderlineStyle#NO_UNDERLINE

The following examples show how to use jxl.format.UnderlineStyle#NO_UNDERLINE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadFileService.java    From pacbot with Apache License 2.0 8 votes vote down vote up
/**
 * Format writable sheet.
 *
 * @param writablesheet the writable sheet
 * @param columns the columns
 * @throws WriteException the write exception
 */
private void formatWritableSheet(WritableSheet writablesheet,List<String>columns) throws WriteException {
    WritableFont cellFonts = new WritableFont(WritableFont.createFont("Calibri"), ELEVEN, WritableFont.BOLD, false,
            UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLACK);
    WritableCellFormat cellFormats = new WritableCellFormat(cellFonts);
    cellFormats.setBorder(Border.ALL, BorderLineStyle.THIN);
    cellFormats.setBackground(Colour.WHITE);
    int labelIndex = 0;
    for (String clm : columns) {
        writablesheet.addCell(new Label(labelIndex, 0, clm.replaceAll("_", ""), cellFormats));
        CellView cell = writablesheet.getColumnView(labelIndex);
        cell.setAutosize(true);
        writablesheet.setColumnView(labelIndex, cell);
        labelIndex++;
    }
}
 
Example 2
Source File: ExcelFontMap.java    From hop with Apache License 2.0 6 votes vote down vote up
public static UnderlineStyle getUnderlineStyle( int transformValue ) {

    UnderlineStyle underline = UnderlineStyle.NO_UNDERLINE;
    switch ( transformValue ) {
      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;
  }
 
Example 3
Source File: ExcelFontMap.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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;
  }
 
Example 4
Source File: SpreadsheetDataSetConsumer.java    From morf with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
  }
}