Package net.sf.jasperreports.engine.design

Examples of net.sf.jasperreports.engine.design.JRDesignReportFont


  /**
   *
   */
  public Object createObject(Attributes atts)
  {
    JRDesignReportFont reportFont = new JRDesignReportFont();

    reportFont.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));
   
    String isDefault = atts.getValue(JRXmlConstants.ATTRIBUTE_isDefault);
    if (isDefault != null && isDefault.length() > 0)
    {
      reportFont.setDefault(Boolean.valueOf(isDefault).booleanValue());
    }

    reportFont.setFontName(atts.getValue(JRXmlConstants.ATTRIBUTE_fontName));

    String isBold = atts.getValue(JRXmlConstants.ATTRIBUTE_isBold);
    if (isBold != null && isBold.length() > 0)
    {
      reportFont.setBold(Boolean.valueOf(isBold));
    }

    String isItalic = atts.getValue(JRXmlConstants.ATTRIBUTE_isItalic);
    if (isItalic != null && isItalic.length() > 0)
    {
      reportFont.setItalic(Boolean.valueOf(isItalic));
    }

    String isUnderline = atts.getValue(JRXmlConstants.ATTRIBUTE_isUnderline);
    if (isUnderline != null && isUnderline.length() > 0)
    {
      reportFont.setUnderline(Boolean.valueOf(isUnderline));
    }

    String isStrikeThrough = atts.getValue(JRXmlConstants.ATTRIBUTE_isStrikeThrough);
    if (isStrikeThrough != null && isStrikeThrough.length() > 0)
    {
      reportFont.setStrikeThrough(Boolean.valueOf(isStrikeThrough));
    }

    String size = atts.getValue(JRXmlConstants.ATTRIBUTE_size);
    if (size != null && size.length() > 0)
    {
      reportFont.setFontSize(Integer.parseInt(size));
    }

    reportFont.setPdfFontName(atts.getValue(JRXmlConstants.ATTRIBUTE_pdfFontName));
    reportFont.setPdfEncoding(atts.getValue(JRXmlConstants.ATTRIBUTE_pdfEncoding));

    String isPdfEmbedded = atts.getValue(JRXmlConstants.ATTRIBUTE_isPdfEmbedded);
    if (isPdfEmbedded != null && isPdfEmbedded.length() > 0)
    {
      reportFont.setPdfEmbedded(Boolean.valueOf(isPdfEmbedded));
    }

    return reportFont;
  }
View Full Code Here


    jasperDesign.setRightMargin(20);
    jasperDesign.setTopMargin(30);
    jasperDesign.setBottomMargin(30);
   
      //Fonts
      normalFont = new JRDesignReportFont();
      normalFont.setName("Arial_Normal");
      normalFont.setDefault(true);
      normalFont.setFontName("Arial");
      normalFont.setSize(10);
      normalFont.setPdfFontName("Helvetica");
      normalFont.setPdfEncoding("Cp1252");
      normalFont.setPdfEmbedded(false);
      jasperDesign.addFont(normalFont);
     
      boldFont = new JRDesignReportFont();
      boldFont.setName("Arial_Bold");
      boldFont.setDefault(false);
      boldFont.setFontName("Arial");
      boldFont.setSize(12);
      boldFont.setBold(true);
      boldFont.setPdfFontName("Helvetica-Bold");
      boldFont.setPdfEncoding("Cp1252");
      boldFont.setPdfEmbedded(false);
      jasperDesign.addFont(boldFont);
     
      italicFont = new JRDesignReportFont();
      italicFont.setName("Arial_Italic");
      italicFont.setDefault(false);
      italicFont.setFontName("Arial");
      italicFont.setSize(12);
      italicFont.setItalic(true);
      italicFont.setPdfFontName("Helvetica-Oblique");
      italicFont.setPdfEncoding("Cp1252");
      italicFont.setPdfEmbedded(false);
      jasperDesign.addFont(italicFont);

      //Title
      JRDesignBand band = new JRDesignBand();
      band.setHeight(50);
      JRDesignLine line = new JRDesignLine();
      line.setX(0);
      line.setY(0);
      line.setWidth(968);
      line.setHeight(0);
      band.addElement(line);
     
      JRDesignStaticText text = new JRDesignStaticText();
     
      text.setX(0);
      text.setY(10);
      text.setWidth(968);
      text.setHeight(30);
      text.setTextAlignment(JRTextElement.TEXT_ALIGN_CENTER);
      JRDesignReportFont bigFont = new JRDesignReportFont();
      bigFont.setName("Arial_Normal");
      bigFont.setDefault(true);
      bigFont.setFontName("Arial");
      bigFont.setSize(22);
      bigFont.setPdfFontName("Helvetica");
      bigFont.setPdfEncoding("Cp1252");
      bigFont.setPdfEmbedded(false);
      text.setFont(bigFont);
      text.setText(reportDefinition.getName());
      band.addElement(text);
      jasperDesign.setTitle(band);
     
View Full Code Here

    {
      maxX = (elements[i].getX() + elements[i].getWidth() > maxX)?(elements[i].getX() + elements[i].getWidth()):maxX;
      maxY = (elements[i].getY() > maxY)?elements[i].getY():maxY;
    }

    JRDesignReportFont normalFont = new JRDesignReportFont();
    normalFont.setFontName("Arial");
    normalFont.setSize(10);
    normalFont.setPdfFontName("Helvetica");
   
   
    try {
      while(iterator.hasNext()) {
       
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.design.JRDesignReportFont

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.