Package jxl.write

Examples of jxl.write.Label


    }

    public void handle(StringTextValue textValue) throws JRException
    {
      WritableCellFormat cellStyle = getLoadedCellStyle(baseStyle);
      result = new Label(x, y, textValue.getText(), cellStyle);
    }
View Full Code Here


  }

  protected CellValue getLabelCell(int x, int y, String textStr, StyleInfo baseStyle) throws JRException
  {
    WritableCellFormat cellStyle = getLoadedCellStyle(baseStyle);
    return new Label(x, y, textStr, cellStyle);
  }
View Full Code Here

          .getVisibility());
      first = false;

    }
    y = y + 1;
    Label label_v = new Label(y, i, field_value);
    sheet.addCell(label_v);
    Label labelCaption = new Label(y, 0, shortName);
    sheet.addCell(labelCaption);
    y = y + 1;
    Label label_vv = new Label(y, i, field_visibility);
    sheet.addCell(label_vv);
    labelCaption = new Label(y, 0, shortName
        + ImportExportUtils.LABELCAPTION_VISIBILITY_SUFFIX);
    sheet.addCell(labelCaption);

    return y;
  }
View Full Code Here

            .getVisibility());
        first = false;

      }
      y = y + 1;
      Label label_v = new Label(y, i, field_value);
      Label labelCaption = new Label(y, 0, decorator.getShortName());
      sheet.addCell(labelCaption);
      y = y + 1;
      Label label_vv = new Label(y, i, field_visibility);
      labelCaption = new Label(y, 0, decorator.getShortName()
          + ImportExportUtils.LABELCAPTION_VISIBILITY_SUFFIX);
      sheet.addCell(labelCaption);

      sheet.addCell(label_v);
      sheet.addCell(label_vv);

    } else if (method.getReturnType().isAssignableFrom(String.class)) {
      y = y + 1;
      sheet.addCell(new Label(y, i, (String) field));
      Label labelCaption = new Label(y, 0, decorator.getShortName());
      sheet.addCell(labelCaption);
    } else {
      if (RestrictedFieldLocalOrRemoteFile.class.isAssignableFrom(method
          .getReturnType())) {
        RestrictedFieldLocalOrRemoteFile rflor = (RestrictedFieldLocalOrRemoteFile) field;
        y = y + 1;
        if (StringUtils.isNotEmpty(rflor.getRemoteUrl())) {
          sheet.addCell(new Label(y, i, rflor.getRemoteUrl()));
        } else {
          sheet.addCell(new Label(y, i, rflor.getMimeType()
              + STOPFIELDS_EXCEL + rflor.getValue()));
        }
        Label labelCaption = new Label(y, 0, decorator.getShortName());
        sheet.addCell(labelCaption);
        y = y + 1;
        sheet.addCell(new Label(y, i, VisibilityConstants
            .getDescription(rflor.getVisibility())));
        labelCaption = new Label(y, 0, decorator.getShortName()
            + ImportExportUtils.LABELCAPTION_VISIBILITY_SUFFIX);
        sheet.addCell(labelCaption);
      } else if (RestrictedFieldFile.class.isAssignableFrom(method
          .getReturnType())) {
        RestrictedFieldFile rflor = (RestrictedFieldFile) field;
        y = y + 1;
        Label labelCaption = new Label(y, 0, decorator.getShortName());
        sheet.addCell(labelCaption);
        if (StringUtils.isNotEmpty(rflor.getValue())) {
          sheet.addCell(new Label(y, i, rflor.getMimeType()
              + STOPFIELDS_EXCEL + rflor.getValue()));
        }
        y = y + 1;
        labelCaption = new Label(y, 0, decorator.getShortName()
            + ImportExportUtils.LABELCAPTION_VISIBILITY_SUFFIX);
        sheet.addCell(labelCaption);
        if (StringUtils.isNotEmpty(rflor.getValue())) {
          sheet.addCell(new Label(y, i, VisibilityConstants
              .getDescription(rflor.getVisibility())));
        }
      } else {
        RestrictedField rr = (RestrictedField) field;
        y = y + 1;
        sheet.addCell(new Label(y, i, rr.getValue()));
        Label labelCaption = new Label(y, 0, decorator.getShortName());
        sheet.addCell(labelCaption);
        y = y + 1;
        sheet.addCell(new Label(y, i, VisibilityConstants
            .getDescription(rr.getVisibility())));
        labelCaption = new Label(y, 0, decorator.getShortName()
            + ImportExportUtils.LABELCAPTION_VISIBILITY_SUFFIX);
        sheet.addCell(labelCaption);
      }
    }
    return y;
View Full Code Here

                    sheet = workbook.createSheet(I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.sheet." + statdetails.getType()),
                            sheetNumber);
                    WritableFont labelFont = new WritableFont(
                            WritableFont.ARIAL, 10, WritableFont.BOLD);
                    WritableCellFormat cfobj = new WritableCellFormat(labelFont);
                    sheet.addCell(new Label(
                            0,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.type"),
                            cfobj));
                    sheet.addCell(new Label(
                            1,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.name"),
                            cfobj));
                    sheet.addCell(new Label(
                            2,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.url"),
                            cfobj));
                    sheet.addCell(new Label(
                            3,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.totalView"),
                            cfobj));
                    sheet.addCell(new Label(4, 0, I18nUtil
                            .getMessage("it.cilea.hku.statistics.Subscribe."
                                    + sfreq + "View"), cfobj));

                    int headerCell = 4;
                    if (statDataBean.isShowSelectedObjectDownload())
                    {
                        sheet.addCell(new Label(
                                ++headerCell,
                                0,
                                I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.totalDownload"),
                                cfobj));
                        sheet.addCell(new Label(++headerCell, 0, I18nUtil
                                .getMessage("it.cilea.hku.statistics.Subscribe."
                                        + sfreq + "Download"), cfobj));
                    }
                    for (String topKey : statDataBean
                            .getPeriodAndTotalTopView().keySet())
                    {
                        if (!statDataBean.getPeriodAndTotalTopView()
                                .get(topKey).isEmpty())
                        {
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.total"
                                            + topKey + "View"), cfobj));
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe."
                                            + sfreq + topKey + "View"), cfobj));
                        }
                    }
                    for (String topKey : statDataBean
                            .getPeriodAndTotalTopDownload().keySet())
                    {
                        if (!statDataBean.getPeriodAndTotalTopDownload()
                                .get(topKey).isEmpty())
                        {
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.total"
                                            + topKey + "Download"), cfobj));
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe."
                                            + sfreq + topKey + "Download"), cfobj));
                        }
                    }
                    for (int i = 0; i < headerCell; i++)
                    {
                        final CellView view = sheet.getColumnView(i);
                        view.setAutosize(true);
                        sheet.setColumnView(i, view);
                    }
                    sheetNumber++;
                }
                sheet.addCell(new Label(0, r, I18nUtil
                        .getMessage("it.cilea.hku.statistics.Subscribe.type."
                                + statdetails.getType())));
                sheet.addCell(new Label(1, r, statdetails.getObjectName()));
                sheet.addCell(new Label(2, r, statdetails.getObjectURL()));
                if (statDataBean.getTotalSelectedView() == -1)
                {
                    sheet.addCell(new Label(3, r, I18nUtil
                            .getMessage("it.cilea.hku.statistics.Subscribe.na")));
                }
                else
                {
                    sheet.addCell(new Label(3, r, new Long(statDataBean
                            .getTotalSelectedView()).toString()));
                }

                if (statDataBean.getPeriodSelectedView() == -1)
                {
                    sheet.addCell(new Label(4, r, I18nUtil
                            .getMessage("it.cilea.hku.statistics.Subscribe.na")));
                }
                else
                {
                    sheet.addCell(new Label(4, r, new Long(statDataBean
                            .getPeriodSelectedView()).toString()));
                }

                int countTopCell = 4;
                if (statDataBean.isShowSelectedObjectDownload())
                {
                    if (statDataBean.getTotalSelectedDownload() == -1)
                    {
                        sheet.addCell(new Label(
                                ++countTopCell,
                                r,
                                I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.na")));
                    }
                    else
                    {
                        sheet.addCell(new Label(++countTopCell, r, new Long(
                                statDataBean.getTotalSelectedDownload())
                                .toString()));
                    }
                    if (statDataBean.getPeriodSelectedDownload() == -1)
                    {
                        sheet.addCell(new Label(
                                ++countTopCell,
                                r,
                                I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.na")));
                    }
                    else
                    {
                        sheet.addCell(new Label(++countTopCell, r, new Long(
                                statDataBean.getPeriodSelectedDownload())
                                .toString()));
                    }

                }
                for (String topKey : statDataBean.getPeriodAndTotalTopView()
                        .keySet())
                {
                    List<Long> tmpList = statDataBean
                            .getPeriodAndTotalTopView().get(topKey);
                    if (!tmpList.isEmpty())
                    {
                        if (tmpList.get(1) == null)
                        {
                            sheet.addCell(new Label(
                                    ++countTopCell,
                                    r,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.na")));
                        }
                        else
                        {
                            sheet.addCell(new Label(++countTopCell, r,
                                    new Long(tmpList.get(1)).toString()));
                        }
                    }
                    if (!tmpList.isEmpty())
                    {
                        if (tmpList.get(0) == null)
                        {
                            sheet.addCell(new Label(
                                    ++countTopCell,
                                    r,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.na")));
                        }
                        else
                        {
                            sheet.addCell(new Label(++countTopCell, r,
                                    new Long(tmpList.get(0)).toString()));
                        }
                    }
                }
                for (String topKey : statDataBean
                        .getPeriodAndTotalTopDownload().keySet())
                {
                    List<Long> tmpList = statDataBean
                            .getPeriodAndTotalTopDownload().get(topKey);
                    if (!tmpList.isEmpty())
                    {
                        if (tmpList.get(1) == null)
                        {
                            sheet.addCell(new Label(
                                    ++countTopCell,
                                    r,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.na")));
                        }
                        else
                        {
                            sheet.addCell(new Label(++countTopCell, r,
                                    new Long(tmpList.get(1)).toString()));
                        }
                    }
                    if (!tmpList.isEmpty())
                    {
                        if (tmpList.get(0) == null)
                        {
                            sheet.addCell(new Label(
                                    ++countTopCell,
                                    r,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.na")));
                        }
                        else
                        {
                            sheet.addCell(new Label(++countTopCell, r,
                                    new Long(tmpList.get(0)).toString()));
                        }
                    }
                }
View Full Code Here

        WritableWorkbook workbook = Workbook.createWorkbook(os);
        WritableSheet sheet = workbook.createSheet("Sheet", 0);

        // create initial caption (other caption could be write field together)
        int x = 0;
        sheet.addCell(new Label(x++, 0, "staffNo"));
        sheet.addCell(new Label(x++, 0, "rp"));
        sheet.addCell(new Label(x++, 0, "rp url"));

        // row index
        int i = 1;
        for (ResearcherPage rp : rps)
        {
            int y = 0;
            sheet.addCell(new Label(0, i, ""));
            Label label = (Label) sheet.getCell(0, i);
            label.setString(rp.getSourceID());
            y++;
            sheet.addCell(new Label(1, i, ""));
            label = (Label) sheet.getCell(1, i);
            label.setString(ResearcherPageUtils.getPersistentIdentifier(rp));
            y++;
            sheet.addCell(new Label(2, i, ""));
            label = (Label) sheet.getCell(2, i);
            label.setString(ConfigurationManager.getProperty("dspace.url")
                    + "/cris/" + rp.getPublicPath() + "/"
                    + ResearcherPageUtils.getPersistentIdentifier(rp));

            for (IContainable containable : metadata)
            {
View Full Code Here

     
      List<String> headers = getHeaders(selectedReport, reportedMethods);
     
      for(String header : headers)
      try {
        sheet.addCell(new Label(currentColumn++, currentRow, header, headerCellFormat));
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
   
 
      // Generates Data Cells
      WritableFont dataFont = new WritableFont(WritableFont.TAHOMA, 12);
      WritableCellFormat dataCellFormat = new WritableCellFormat(dataFont);
      WritableCellFormat dateCellFormat = new WritableCellFormat(dataFont, DateFormats.FORMAT2);
     
     
      for(Object row : getRows(selectedReport))
      {
        List<Object> rowData = renderRow(reportedMethods, row);
        if(rowData.size() != headers.size())
          throw new RuntimeException( String.format(
                      "Wrong number of columns returned when rendering row %s, against headers %s",
                      row.toString(), headers.toString()));
        currentRow++;
        currentColumn = 0;
        for(Object cellData : rowData)
        {
         if (cellData != null )
         {
           WritableCell cell = null;
         
           if (cellData instanceof NamedEntity)
             cellData = ((NamedEntity)cellData).getName();
           else if (cellData instanceof Text)
             cellData = ((Text)cellData).getValue();
          
           else if (cellData instanceof Email)
             cellData = ((Email)cellData).getEmail();
          
           if (cellData instanceof Number)
           {
             cell = new jxl.write.Number(currentColumn, currentRow, ((Number)cellData).doubleValue(), dataCellFormat);
           } else if (cellData instanceof Date)
           {
             cell = new DateTime(currentColumn, currentRow, (Date)cellData, dateCellFormat);
           } else
           {
             if (!(cellData instanceof String) )
               cellData = cellData.toString();
           
             cell = new Label(currentColumn, currentRow, (String)cellData, dataCellFormat);
            
           }      
          
          
           try {
View Full Code Here

        workbook = Workbook.createWorkbook(new File(savaPath));    // 创建可写入的Excel工作薄
        WritableSheet ws = workbook.createSheet(sheetName, index)// 创建可写入的Excel工作表
        int cols = contents.length / rows;              // 根据行数得出列数,在数据库里比较容易得到行数
        for (int row = 0; row < rows; row++) {
          for (int col = 0; col < cols; col++) {
            Label label = new Label(col, row,contents[col + row * cols]);
            ws.addCell(label); // 添加Label对象,单元格内容
          }
        }
        workbook.write(); // 写入excel
        workbook.close(); // 关闭对象,释放资源
View Full Code Here

      workbook = Workbook.createWorkbook(os);          // 创建可写入的Excel工作薄
      WritableSheet ws = workbook.createSheet("Sheet1", 0)// 创建可写入的Excel工作表
      int cols = datas.size() / rows;              // 根据行数得出列数,在数据库里比较容易得到行数
      for (int row = 0; row < rows; row++) {
        for (int col = 0; col < cols; col++) {
          Label label = new Label(col, row,(String) datas.get(col + row * cols));
          ws.addCell(label); // 添加Label对象,单元格内容
        }
      }
      workbook.write(); // 写入excel
      workbook.close(); // 关闭对象,释放资源
View Full Code Here

    s.setColumnView(4,20);
    s.setColumnView(5,20);
    s.setColumnView(6,20);

    // Floats
    Label l = new Label(0,0,"+/- Pi - default format", wrappedText);
    s.addCell(l);

    Number n = new Number(1,0,3.1415926535);
    s.addCell(n);

    n = new Number(2,0,-3.1415926535);
    s.addCell(n);

    l = new Label(0,1,"+/- Pi - integer format", wrappedText);
    s.addCell(l);

    WritableCellFormat cf1 = new WritableCellFormat(NumberFormats.INTEGER);
    n = new Number(1,1,3.1415926535,cf1);
    s.addCell(n);

    n = new Number(2,1,-3.1415926535, cf1);
    s.addCell(n);

    l = new Label(0,2,"+/- Pi - float 2dps", wrappedText);
    s.addCell(l);

    WritableCellFormat cf2 = new WritableCellFormat(NumberFormats.FLOAT);
    n = new Number(1,2,3.1415926535,cf2);
    s.addCell(n);

    n = new Number(2,2,-3.1415926535, cf2);
    s.addCell(n);

    l = new Label(0,3,"+/- Pi - custom 3dps",
                  wrappedText);
    s.addCell(l);

    NumberFormat dp3 = new NumberFormat("#.###");
    WritableCellFormat dp3cell = new WritableCellFormat(dp3);
    n = new Number(1,3,3.1415926535,dp3cell);
    s.addCell(n);

    n = new Number(2,3,-3.1415926535, dp3cell);
    s.addCell(n);

    l = new Label(0,4,"+/- Pi - custom &3.14",
                  wrappedText);
    s.addCell(l);

    NumberFormat pounddp2 = new NumberFormat("&#.00");
    WritableCellFormat pounddp2cell = new WritableCellFormat(pounddp2);
    n = new Number(1,4,3.1415926535,pounddp2cell);
    s.addCell(n);

    n = new Number(2,4,-3.1415926535, pounddp2cell);
    s.addCell(n);

    l = new Label(0,5,"+/- Pi - custom Text #.### Text",
                  wrappedText);
    s.addCell(l);

    NumberFormat textdp4 = new NumberFormat("Text#.####Text");
    WritableCellFormat textdp4cell = new WritableCellFormat(textdp4);
    n = new Number(1,5,3.1415926535, textdp4cell);
    s.addCell(n);

    n = new Number(2,5,-3.1415926535, textdp4cell);
    s.addCell(n);

    // Integers
    l = new Label(4,0,"+/- Bilko default format");
    s.addCell(l);
    n = new Number(5, 0, 15042699);
    s.addCell(n);
    n = new Number(6, 0, -15042699);
    s.addCell(n);

    l = new Label(4,1,"+/- Bilko float format");
    s.addCell(l);
    WritableCellFormat cfi1 = new WritableCellFormat(NumberFormats.FLOAT);
    n = new Number(5, 1, 15042699, cfi1);
    s.addCell(n);
    n = new Number(6, 1, -15042699, cfi1);
    s.addCell(n);

    l = new Label(4,2,"+/- Thousands separator");
    s.addCell(l);
    WritableCellFormat cfi2 = new WritableCellFormat
      (NumberFormats.THOUSANDS_INTEGER);
    n = new Number(5, 2, 15042699,cfi2 );
    s.addCell(n);
    n = new Number(6, 2, -15042699, cfi2);
    s.addCell(n);

    l = new Label(4,3,"+/- Accounting red - added 0.01");
    s.addCell(l);
    WritableCellFormat cfi3 = new WritableCellFormat
      (NumberFormats.ACCOUNTING_RED_FLOAT);
    n = new Number(5, 3, 15042699.01, cfi3);
    s.addCell(n);
    n = new Number(6, 3, -15042699.01, cfi3);
    s.addCell(n);

    l = new Label(4,4,"+/- Percent");
    s.addCell(l);
    WritableCellFormat cfi4 = new WritableCellFormat
      (NumberFormats.PERCENT_INTEGER);
    n = new Number(5, 4, 15042699, cfi4);
    s.addCell(n);
    n = new Number(6, 4, -15042699, cfi4);
    s.addCell(n);

    l = new Label(4,5,"+/- Exponential - 2dps");
    s.addCell(l);
    WritableCellFormat cfi5 = new WritableCellFormat
      (NumberFormats.EXPONENTIAL);
    n = new Number(5, 5, 15042699, cfi5);
    s.addCell(n);
    n = new Number(6, 5, -15042699, cfi5);
    s.addCell(n);

    l = new Label(4,6,"+/- Custom exponentional - 3dps", wrappedText);
    s.addCell(l);
    NumberFormat edp3 = new NumberFormat("0.000E0");
    WritableCellFormat edp3Cell = new WritableCellFormat(edp3);
    n = new Number(5,6,15042699,edp3Cell);
    s.addCell(n);
    n = new Number(6,6,-15042699,edp3Cell);
    s.addCell(n);

    l = new Label(4, 7, "Custom neg brackets", wrappedText);
    s.addCell(l);
    NumberFormat negbracks = new NumberFormat("#,##0;(#,##0)");
    WritableCellFormat negbrackscell = new WritableCellFormat(negbracks);
    n = new Number(5,7, 15042699, negbrackscell);
    s.addCell(n);
    n = new Number(6,7, -15042699, negbrackscell);
    s.addCell(n);

    l = new Label(4, 8, "Custom neg brackets 2", wrappedText);
    s.addCell(l);
    NumberFormat negbracks2 = new NumberFormat("#,##0;(#,##0)a");
    WritableCellFormat negbrackscell2 = new WritableCellFormat(negbracks2);
    n = new Number(5,8, 15042699, negbrackscell2);
    s.addCell(n);
    n = new Number(6,8, -15042699, negbrackscell2);
    s.addCell(n);

    l = new Label(4, 9, "Custom percent", wrappedText);
    s.addCell(l);
    NumberFormat cuspercent = new NumberFormat("0.0%");
    WritableCellFormat cuspercentf = new WritableCellFormat(cuspercent);
    n = new Number(5, 9, 3.14159265, cuspercentf);
    s.addCell(n);
   

    // Booleans
    l = new Label(0,10, "Boolean - TRUE");
    s.addCell(l);
    Boolean b = new Boolean(1,10, true);
    s.addCell(b);

    l = new Label(0,11, "Boolean - FALSE");
    s.addCell(l);
    b = new Boolean(1,11,false);
    s.addCell(b);

    l = new Label(0, 12, "A hidden cell->");
    s.addCell(l);
    n = new Number(1, 12, 17, WritableWorkbook.HIDDEN_STYLE);
    s.addCell(n);

    // Currencies
    l = new Label(4, 19, "Currency formats");
    s.addCell(l);

    l = new Label(4, 21, "UK Pound");
    s.addCell(l);
    NumberFormat poundCurrency =
      new NumberFormat(NumberFormat.CURRENCY_POUND + " #,###.00",
                       NumberFormat.COMPLEX_FORMAT);
    WritableCellFormat poundFormat = new WritableCellFormat(poundCurrency);
    n = new Number(5, 21, 12345, poundFormat);
    s.addCell(n);

    l = new Label(4, 22, "Euro 1");
    s.addCell(l);
    NumberFormat euroPrefixCurrency =
      new NumberFormat(NumberFormat.CURRENCY_EURO_PREFIX + " #,###.00",
                       NumberFormat.COMPLEX_FORMAT);
    WritableCellFormat euroPrefixFormat =
      new WritableCellFormat(euroPrefixCurrency);
    n = new Number(5, 22, 12345, euroPrefixFormat);
    s.addCell(n);

    l = new Label(4, 23, "Euro 2");
    s.addCell(l);
    NumberFormat euroSuffixCurrency =
      new NumberFormat("#,###.00" + NumberFormat.CURRENCY_EURO_SUFFIX,
                       NumberFormat.COMPLEX_FORMAT);
    WritableCellFormat euroSuffixFormat =
      new WritableCellFormat(euroSuffixCurrency);
    n = new Number(5, 23, 12345, euroSuffixFormat);
    s.addCell(n);

    l = new Label(4, 24, "Dollar");
    s.addCell(l);
    NumberFormat dollarCurrency =
      new NumberFormat(NumberFormat.CURRENCY_DOLLAR + " #,###.00",
                       NumberFormat.COMPLEX_FORMAT);
    WritableCellFormat dollarFormat =
      new WritableCellFormat(dollarCurrency);
    n = new Number(5, 24, 12345, dollarFormat);
    s.addCell(n);

    l = new Label(4, 25, "Japanese Yen");
    s.addCell(l);
    NumberFormat japaneseYenCurrency =
      new NumberFormat(NumberFormat.CURRENCY_JAPANESE_YEN + " #,###.00",
                       NumberFormat.COMPLEX_FORMAT);
    WritableCellFormat japaneseYenFormat =
      new WritableCellFormat(japaneseYenCurrency);
    n = new Number(5, 25, 12345, japaneseYenFormat);
    s.addCell(n);

    l = new Label(4, 30, "Fraction formats");
    s.addCell(l);

    l = new Label(4,32, "One digit fraction format", wrappedText);
    s.addCell(l);

    WritableCellFormat fraction1digitformat =
      new WritableCellFormat(NumberFormats.FRACTION_ONE_DIGIT);
    n = new Number(5, 32, 3.18279, fraction1digitformat);
    s.addCell(n);

    l = new Label(4,33, "Two digit fraction format", wrappedText);
    s.addCell(l);

    WritableCellFormat fraction2digitformat =
      new WritableCellFormat(NumberFormats.FRACTION_TWO_DIGITS);
    n = new Number(5, 33, 3.18279, fraction2digitformat);
    s.addCell(n);

    l = new Label(4,34, "Three digit fraction format (improper)", wrappedText);
    s.addCell(l);

    NumberFormat fraction3digit1 =
      new NumberFormat(NumberFormat.FRACTION_THREE_DIGITS,
                       NumberFormat.COMPLEX_FORMAT);
    WritableCellFormat fraction3digitformat1 =
      new WritableCellFormat(fraction3digit1);
    n = new Number(5, 34, 3.18927, fraction3digitformat1);
    s.addCell(n);

    l = new Label(4,35, "Three digit fraction format (proper)", wrappedText);
    s.addCell(l);

    NumberFormat fraction3digit2 =
      new NumberFormat("# " + NumberFormat.FRACTION_THREE_DIGITS,
                       NumberFormat.COMPLEX_FORMAT);
View Full Code Here

TOP

Related Classes of jxl.write.Label

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.