コード例 #1
0
  private void createLabel(WritableSheet sheet) throws WriteException {

    WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);
    // Define the cell format
    times = new WritableCellFormat(times10pt);
    // Lets automatically wrap the cells
    times.setWrap(true);

    // create create a bold font with unterlines
    WritableFont times10ptBoldUnderline =
        new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false, UnderlineStyle.SINGLE);
    timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);
    // Lets automatically wrap the cells
    timesBoldUnderline.setWrap(true);

    CellView cv = new CellView();
    cv.setFormat(times);
    cv.setFormat(timesBoldUnderline);

    // Write a few headers
    addCaption(sheet, 0, 0, "Adı");
    addCaption(sheet, 1, 0, "Miktar");
    addCaption(sheet, 2, 0, "Birim");
    addCaption(sheet, 3, 0, "Fiyat");
    addCaption(sheet, 4, 0, "Etiketler");
  }
コード例 #2
0
ファイル: WriteExcel.java プロジェクト: kantale/molgenis_apps
  private void createLabel(WritableSheet sheet, List<String> labels) throws WriteException {

    WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);
    times = new WritableCellFormat(times10pt);
    times.setWrap(true);

    WritableFont times10ptBoldUnderline =
        new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false, UnderlineStyle.SINGLE);
    timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);
    timesBoldUnderline.setWrap(true);

    CellView cv = new CellView();
    cv.setFormat(times);
    cv.setFormat(timesBoldUnderline);
    cv.setAutosize(true);

    // add one label
    for (int i = 0; i < labels.size(); i++) addCaption(sheet, i, 0, labels.get(i));
  }
コード例 #3
0
  /**
   * Gets the column width for the specified column
   *
   * @param col the column number
   * @return the column format, or the default format if no override is specified
   */
  public CellView getColumnView(int col) {
    ColumnInfoRecord cir = getColumnInfo(col);
    CellView cv = new CellView();

    if (cir != null) {
      cv.setDimension(cir.getWidth() / 256);
      cv.setHidden(cir.getHidden());
      cv.setFormat(formattingRecords.getXFRecord(cir.getXFIndex()));
    } else {
      cv.setDimension(settings.getDefaultColumnWidth() / 256);
    }

    return cv;
  }