Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.FormatText


 
  public static String getCellText(Worksheet sheet, Cell cell) {
    CellStyle style = (cell == null) ? null : cell.getCellStyle();
    boolean wrap = style != null && style.getWrapText();
    Hyperlink hlink = cell == null ? null : Utils.getHyperlink(cell);
    final FormatText ft = (cell == null) ? null : Utils.getFormatText(cell);
   
    final RichTextString rstr = ft != null && ft.isRichTextString() ? ft.getRichTextString() : null;
    String text = rstr != null ? Utils.formatRichTextString(sheet, rstr, wrap) : ft != null ? Utils.escapeCellText(ft.getCellFormatResult().text, wrap, true) : "";
    if (hlink != null) {
      text = Utils.formatHyperlink(sheet, hlink, text, wrap);
    }
    return text;
  }
View Full Code Here


        bgColor = null;
      }
      if (bgColor != null) {
        sb.append("background-color:").append(bgColor).append(";");
      }
      final FormatText ft = Utils.getFormatText(_cell);
      final boolean isRichText = ft.isRichTextString();
      final RichTextString rstr = isRichText ? ft.getRichTextString() : null;
      final String txt = rstr != null ? rstr.getString() : ft.getCellFormatResult().text;
     
      if(_cell.getCellType() == Cell.CELL_TYPE_BLANK) {
        sb.append("z-index:-1;"); //For IE6/IE7's overflow
      }
    }
View Full Code Here

     
      //sb.append(BookHelper.getFontCSSStyle(_book, font));
      sb.append(BookHelper.getFontCSSStyle(_cell, font));

      //condition color
      final FormatText ft = Utils.getFormatText(_cell);
      final boolean isRichText = ft.isRichTextString();
      if (!isRichText && ft.getCellFormatResult().textColor != null) {
        final Color textColor = ft.getCellFormatResult().textColor;
        final String htmlColor = toHTMLColor(textColor);
        sb.append("color:").append(htmlColor).append(";");
      }

      return sb.toString();
View Full Code Here

    testZero(row4, 3, "  0/1  "); // 2 spaces + 0/1 + 2 spaces
  }

  private void testOneRow(Row row) {
    Cell cellA = row.getCell(0);
    FormatText a = BookHelper.getFormatText(cellA);
    assertTrue("Should be a rich text string", a.isRichTextString());
    assertTrue("Should not be a Format cell", !a.isCellFormatResult());
   
    Cell cellB = row.getCell(1);
    FormatText b = BookHelper.getFormatText(cellB);
    assertTrue(!b.isRichTextString());
    assertTrue(b.isCellFormatResult());
   
    assertEquals(a.getRichTextString().getString(), b.getCellFormatResult().text);
  }
View Full Code Here

    assertEquals(a.getRichTextString().getString(), b.getCellFormatResult().text);
  }
 
  private void testZero(Row row, int colindex, String expect) {
    Cell cell = row.getCell(colindex);
    FormatText c = BookHelper.getFormatText(cell);
    assertTrue(!c.isRichTextString());
    assertTrue(c.isCellFormatResult());
   
    assertEquals(expect, c.getCellFormatResult().text);
  }
View Full Code Here

    testCell(row2, 0, " -   "); //1 space - 3 spaces
  }

  private void testCell(Row row, int colindex, String expect) {
    Cell cell = row.getCell(colindex);
    FormatText c = BookHelper.getFormatText(cell);
    assertTrue(!c.isRichTextString());
    assertTrue(c.isCellFormatResult());
   
    assertEquals(expect, c.getCellFormatResult().text);
  }
View Full Code Here

    testZero(row4, 3, "  0/1  "); // 2 spaces + 0/1 + 2 spaces
  }

  private void testOneRow(Row row) {
    Cell cellA = row.getCell(0);
    FormatText a = BookHelper.getFormatText(cellA);
    assertTrue("Should be a rich text string", a.isRichTextString());
    assertTrue("Should not be a Format cell", !a.isCellFormatResult());
   
    Cell cellB = row.getCell(1);
    FormatText b = BookHelper.getFormatText(cellB);
    assertTrue(!b.isRichTextString());
    assertTrue(b.isCellFormatResult());
   
    assertEquals(a.getRichTextString().getString(), b.getCellFormatResult().text);
  }
View Full Code Here

    assertEquals(a.getRichTextString().getString(), b.getCellFormatResult().text);
  }
 
  private void testZero(Row row, int colindex, String expect) {
    Cell cell = row.getCell(colindex);
    FormatText c = BookHelper.getFormatText(cell);
    assertTrue(!c.isRichTextString());
    assertTrue(c.isCellFormatResult());
   
    assertEquals(expect, c.getCellFormatResult().text);
  }
View Full Code Here

    }*/
    final Cell cell = Utils.getCell(sheet, row, column);
    String text = "";
    if (cell != null) {
      boolean wrap = cell.getCellStyle().getWrapText();
      final FormatText ft = Utils.getFormatText(cell);
      if (ft != null) {
        if (ft.isRichTextString()) {
          final RichTextString rstr = ft.getRichTextString();
          text = rstr == null ? "" : Utils.formatRichTextString(sheet, rstr, wrap);
        } else if (ft.isCellFormatResult()) {
          text = Utils.escapeCellText(ft.getCellFormatResult().text, wrap, true);
        }
      }
      final Hyperlink hlink = Utils.getHyperlink(cell);
      if (hlink != null) {
        text = Utils.formatHyperlink(sheet, hlink, text, wrap);
View Full Code Here

 
  static public String getCellFormatText(Worksheet sheet, int row,int column) {
    final Cell cell = Utils.getCell(sheet, row, column);
    String text = "";
    if (cell != null) {
      final FormatText ft = Utils.getFormatText(cell);
      if (ft != null) {
        if (ft.isRichTextString()) {
          final RichTextString rstr = ft.getRichTextString();
          text = rstr == null ? "" : rstr.toString();
        } else if (ft.isCellFormatResult()) {
          text = ft.getCellFormatResult().text;
        }
      }
    }
    return text;
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.model.FormatText

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.