Package jxl.write

Examples of jxl.write.WritableFont


    {
      mode = Pattern.SOLID;
      backcolor = getWorkbookColour(gridCell.getCellBackcolor(), true);
    }

    WritableFont cellFont = getLoadedFont(getDefaultFont(), forecolor.getValue(), getLocale());
    WritableCellFormat cellStyle =
      getLoadedCellStyle(
        mode,
        backcolor,
        cellFont,
View Full Code Here


  protected void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int col, int row) throws JRException
  {
    addMergeRegion(gridCell, col, row);

    Colour forecolor2 = getWorkbookColour(line.getLinePen().getLineColor());
    WritableFont cellFont2 = getLoadedFont(getDefaultFont(), forecolor2.getValue(), getLocale());
   
    Colour backcolor = WHITE;
    Pattern mode = this.backgroundMode;

    if (!isIgnoreCellBackground && gridCell.getCellBackcolor() != null)
View Full Code Here

      mode = Pattern.SOLID;
      backcolor = getWorkbookColour(gridCell.getCellBackcolor(), true);
    }

    Colour forecolor = getWorkbookColour(element.getLinePen().getLineColor());
    WritableFont cellFont2 = getLoadedFont(getDefaultFont(), forecolor.getValue(), getLocale());
    WritableCellFormat cellStyle2 =
      getLoadedCellStyle(
        mode,
        backcolor,
        cellFont2,
View Full Code Here

    JRStyledText styledText = getStyledText(text);

    if (styledText != null)
    {
      Colour forecolor = getWorkbookColour(text.getForecolor());
      WritableFont cellFont = this.getLoadedFont(text, forecolor.getValue(), getTextLocale(text));

      TextAlignHolder alignment = getTextAlignHolder(text);
      int horizontalAlignment = getHorizontalAlignment(alignment);
      int verticalAlignment = getVerticalAlignment(alignment);
      int rotation = getRotation(alignment);
View Full Code Here

        background = getWorkbookColour(element.getBackcolor(), true);
      }

      Colour forecolor = getWorkbookColour(element.getLineBox().getPen().getLineColor());

      WritableFont cellFont2 = this.getLoadedFont(getDefaultFont(), forecolor.getValue(), getLocale());

      WritableCellFormat cellStyle2 =
        getLoadedCellStyle(
          mode,
          background,
View Full Code Here

    return retVal;
  }*/

  private WritableFont getLoadedFont(JRFont font, int forecolor, Locale locale) throws JRException
  {
    WritableFont cellFont = null;

    if (this.loadedFonts != null && this.loadedFonts.size() > 0)
    {
      for (int i = 0; i < this.loadedFonts.size(); i++)
      {
        WritableFont cf = (WritableFont) this.loadedFonts.get(i);

        int fontSize = font.getFontSize();
        if (isFontSizeFixEnabled)
        {
          fontSize -= 1;
        }
        String fontName = font.getFontName();
        if (fontMap != null && fontMap.containsKey(fontName))
        {
          fontName = (String) fontMap.get(fontName);
        }
        else
        {
          FontInfo fontInfo = JRFontUtil.getFontInfo(fontName, locale);
          if (fontInfo != null)
          {
            //fontName found in font extensions
            FontFamily family = fontInfo.getFontFamily();
            String exportFont = family.getExportFont(getExporterKey());
            if (exportFont != null)
            {
              fontName = exportFont;
            }
          }
        }

        if ((cf.getName().equals(fontName))
            && (cf.getColour().getValue() == forecolor)
            && (cf.getPointSize() == fontSize)
            && (cf.getUnderlineStyle() == UnderlineStyle.SINGLE ? (font.isUnderline()) : (!font.isUnderline()))
            && (cf.isStruckout() == font.isStrikeThrough())
            && (cf.getBoldWeight() == BoldStyle.BOLD.getValue() ? (font.isBold()) : (!font.isBold()))
            && (cf.isItalic() == font.isItalic()))
        {
          cellFont = cf;
          break;
        }
      }
    }

    try
    {
      if (cellFont == null)
      {
        int fontSize = font.getFontSize();
        if (isFontSizeFixEnabled)
        {
          fontSize -= 1;
        }
        String fontName = font.getFontName();
        if (fontMap != null && fontMap.containsKey(fontName))
        {
          fontName = (String) fontMap.get(fontName);
        }

        cellFont =
          new WritableFont(
            WritableFont.createFont(fontName),
            fontSize,
            font.isBold() ? WritableFont.BOLD : WritableFont.NO_BOLD,
            font.isItalic(),
            font.isUnderline() ? UnderlineStyle.SINGLE : UnderlineStyle.NO_UNDERLINE,
View Full Code Here

    {
      mode = Pattern.SOLID;
      backcolor = getWorkbookColour(frame.getBackcolor(), true);
    }

    WritableFont cellFont = getLoadedFont(getDefaultFont(), forecolor.getValue(), getLocale());
    WritableCellFormat cellStyle =
      getLoadedCellStyle(
        mode,
        backcolor,
        cellFont,
View Full Code Here

                if (changedType)
                {
                    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,
View Full Code Here

        throw new RuntimeException(e);
      }
      WritableSheet sheet = workBook.createSheet("Results", 0);
 
      // Generates Headers Cells
      WritableFont headerFont = new WritableFont(WritableFont.TAHOMA, 12, WritableFont.BOLD);
      WritableCellFormat headerCellFormat = new WritableCellFormat(headerFont);
     // headerCellFormat.setBackground(Colour.PALE_BLUE);
     
      int currentRow = 0;
      int currentColumn = 0;
     
      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))
View Full Code Here

    Label l = null;
    WritableCellFeatures wcf = null;

    // Change the format of cell B4 to be emboldened
    cell = sheet.getWritableCell(1,3);
    WritableFont bold = new WritableFont(WritableFont.ARIAL,
                                         WritableFont.DEFAULT_POINT_SIZE,
                                         WritableFont.BOLD);
    cf = new WritableCellFormat(bold);
    cell.setCellFormat(cf);

    // Change the format of cell B5 to be underlined
    cell = sheet.getWritableCell(1,4);
    WritableFont underline = new WritableFont(WritableFont.ARIAL,
                                              WritableFont.DEFAULT_POINT_SIZE,
                                              WritableFont.NO_BOLD,
                                              false,
                                              UnderlineStyle.SINGLE);
    cf = new WritableCellFormat(underline);
    cell.setCellFormat(cf);

    // Change the point size of cell B6 to be 10 point
    cell = sheet.getWritableCell(1,5);
    WritableFont tenpoint = new WritableFont(WritableFont.ARIAL, 10);
    cf = new WritableCellFormat(tenpoint);
    cell.setCellFormat(cf);

    // Change the contents of cell B7 to read "Label - mod"
    cell = sheet.getWritableCell(1,6);
View Full Code Here

TOP

Related Classes of jxl.write.WritableFont

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.