Package net.sf.jasperreports.engine.export.data

Examples of net.sf.jasperreports.engine.export.data.TextValue


    return tzId == null ? null : JRDataUtils.getTimeZone(tzId);
  }
 
  protected TextValue getTextValue(JRPrintText text, String textStr)
  {
    TextValue textValue;
    if (text.getValueClassName() == null)
    {
      textValue = getTextValueString(text, textStr);
    }
    else
View Full Code Here


    return new BooleanTextValue(textStr, value);
  }

  protected TextValue getDateCellValue(JRPrintText text, String textStr) throws ParseException
  {
    TextValue textValue;
    String pattern = text.getPattern();
    if (pattern == null || pattern.trim().length() == 0)
    {
      textValue = getTextValueString(text, textStr);
    }
View Full Code Here

    return textValue;
  }

  protected TextValue getNumberCellValue(JRPrintText text, String textStr) throws ParseException, ClassNotFoundException
  {
    TextValue textValue;
    String pattern = text.getPattern();
    if (pattern == null || pattern.trim().length() == 0)
    {
      if (textStr != null && textStr.length() > 0)
      {
View Full Code Here

  protected void addCell(int x, int y, JRPrintText text, String textStr, StyleInfo baseStyle) throws WriteException, RowsExceededException, JRException
  {
    CellValue cellValue = null;

    TextValue textValue = null;

    String textFormula = getFormula(text);
    if( textFormula != null)
    {
      // if the cell has formula, we try create a formula cell
View Full Code Here

    final int textLength = styledText == null ? 0 : styledText.length();

    final String textStr = styledText.getText();

    TextValue textValue = null;
    if (isDetectCellType)
    {
      textValue = getTextValue(text, textStr);
    }
   
    cellHelper.exportHeader(
      gridCell, rowIndex, colIndex, textValue,
      getConvertedPattern(text.getPattern()),
      getTextLocale(text),
      isWrapText(gridCell.getElement()),
      isCellHidden(gridCell.getElement()),
      isCellLocked(gridCell.getElement())
      );
    sheetHelper.exportMergedCells(rowIndex, colIndex, gridCell.getRowSpan(), gridCell.getColSpan());

    String textFormula = getFormula(text);
    if (textFormula != null)
    {
      sheetHelper.write("<f>" + textFormula + "</f>\n");
    }

//    if (text.getLineSpacing() != JRTextElement.LINE_SPACING_SINGLE)
//    {
//      styleBuffer.append("line-height: " + text.getLineSpacingFactor() + "; ");
//    }

//    if (styleBuffer.length() > 0)
//    {
//      writer.write(" style=\"");
//      writer.write(styleBuffer.toString());
//      writer.write("\"");
//    }
//
//    writer.write(">");
   
//    tableHelper.getParagraphHelper().exportProps(text);
   
//    insertPageAnchor();
//    if (text.getAnchorName() != null)
//    {
//      tempBodyWriter.write("<text:bookmark text:name=\"");
//      tempBodyWriter.write(text.getAnchorName());
//      tempBodyWriter.write("\"/>");
//    }

    String href = getHyperlinkURL(text);
    if (href != null)
    {
      sheetHelper.exportHyperlink(rowIndex, colIndex, href);
    }

   
    TextValueHandler handler =
      new TextValueHandler()
      {
        public void handle(BooleanTextValue textValue) throws JRException {
          writeText();
        }
       
        public void handle(DateTextValue textValue) throws JRException {
          Date date = textValue.getValue();
          sheetHelper.write(
            "<v>"
            + (date == null ? "" : JRDataUtils.getExcelSerialDayNumber(
              date,
              getTextLocale(text),
              getTextTimeZone(text)
              ))
            + "</v>"
            );
        }
       
        public void handle(NumberTextValue textValue) throws JRException {
          Number number = textValue.getValue();
          sheetHelper.write(
            "<v>"
            + (number == null ? "" : number)
            + "</v>"
            );
        }
       
        public void handle(StringTextValue textValue) throws JRException {
          writeText();
        }
       
        private void writeText() throws JRException {
          sheetHelper.write("<is>");//FIXMENOW make writer util; check everywhere
 
          if (textLength > 0)
          {
            exportStyledText(text.getStyle(), styledText, getTextLocale(text));
          }
 
          sheetHelper.write("</is>");
        }
      };
   
    if (textValue != null)
    {
      //detect cell type
      textValue.handle(handler);
    }
    else
    {
      handler.handle((StringTextValue)null);
    }
View Full Code Here

   
    if (formula != null)
    { 
      try
      {
        TextValue value = getTextValue(textElement, textStr);
       
        if (value instanceof NumberTextValue && ((NumberTextValue)value).getPattern() != null)
        {
          baseStyle.setDataFormat(
            dataFormat.getFormat(
              getConvertedPattern(((NumberTextValue)value).getPattern())
              )
            );
        }
        else if (value instanceof DateTextValue && ((DateTextValue)value).getPattern() != null)
        {
          baseStyle.setDataFormat(
              dataFormat.getFormat(
                getConvertedPattern(((DateTextValue)value).getPattern())
                )
              );
         
        }
       
        HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
        cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
        cell.setCellFormula(formula);
        endCreateCell(cellStyle);
        return;
      }
      catch(Exception e)//FIXMENOW what exceptions could we get here?
      {
        if(log.isWarnEnabled())
        {
          log.warn(e.getMessage());
        }
      }
    }

    if (isDetectCellType)
    {
      TextValue value = getTextValue(textElement, textStr);
      value.handle(new TextValueHandler()
      {
        public void handle(StringTextValue textValue)
        {
          HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
          if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.export.data.TextValue

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.