Package org.zkoss.poi.ss.usermodel

Examples of org.zkoss.poi.ss.usermodel.Hyperlink


      break;
    case Cell.CELL_TYPE_STRING:
      cell.setCellValue(cv.getStringValue());
      break;
    }
    Hyperlink hyperlink = cv.getHyperlink();
    if (hyperlink != null) {
      if (cell instanceof HSSFCell)
        ((HSSFCell)cell).setEvalHyperlink(hyperlink);
      else
        ((XSSFCell)cell).setEvalHyperlink(hyperlink);
View Full Code Here


    final String hex = Integer.toHexString(num);
    return hex.length() == 1 ? "0"+hex : hex;
  }

  public static Hyperlink getHyperlink(Cell cell) {
    final Hyperlink hyperlink = cell.getHyperlink();
    if (hyperlink != null) {
      return hyperlink;
    }
    if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
      BookHelper.evaluate((Book)cell.getSheet().getWorkbook(), cell);
View Full Code Here

    //notify to update cache
    return getBothDependents(cell);
  }
 
  public static Set<Ref>[] setCellHyperlink(Cell cell, int linkTarget, String address) {
    Hyperlink hlink = cell.getHyperlink();
    if (hlink == null) {
      Workbook wb = cell.getSheet().getWorkbook();
      CreationHelper createHelper = wb.getCreationHelper();
      Hyperlink link = createHelper.createHyperlink(linkTarget);
      link.setAddress(address);
     
      cell.setHyperlink(link);
    } else {
     
      if (sameHyperlink(cell, hlink, linkTarget, address))
View Full Code Here

  }
 
  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) {
View Full Code Here

    Cell cellA5 = row5.getCell(0);
    Cell cellA6 = row6.getCell(0);
    Cell cellA7 = row7.getCell(0);
   
//    BookHelper.evaluate((Book)_workbook, cellA2);
    Hyperlink hlinkA1 = Utils.getHyperlink(cellA1);
    Hyperlink hlinkA2 = Utils.getHyperlink(cellA2);
    Hyperlink hlinkA3 = Utils.getHyperlink(cellA3);
    Hyperlink hlinkA4 = Utils.getHyperlink(cellA4);
    Hyperlink hlinkA5 = Utils.getHyperlink(cellA5);
    Hyperlink hlinkA6 = Utils.getHyperlink(cellA6);
    Hyperlink hlinkA7 = Utils.getHyperlink(cellA7);
   
    String textA1 = BookHelper.getCellText(cellA1);
    String textA2 = BookHelper.getCellText(cellA2);
    String textA3 = BookHelper.getCellText(cellA3);
    String textA4 = BookHelper.getCellText(cellA4);
    String textA5 = BookHelper.getCellText(cellA5);
    String textA6 = BookHelper.getCellText(cellA6);
    String textA7 = BookHelper.getCellText(cellA7);
   
    String stringA1 = Utils.formatHyperlink(sheet1, hlinkA1, textA1, true);
    String stringA2 = Utils.formatHyperlink(sheet1, hlinkA2, textA2, true);
    String stringA3 = Utils.formatHyperlink(sheet1, hlinkA3, textA3, true);
    String stringA4 = Utils.formatHyperlink(sheet1, hlinkA4, textA4, true);
    String stringA5 = Utils.formatHyperlink(sheet1, hlinkA5, textA5, true);
    String stringA6 = Utils.formatHyperlink(sheet1, hlinkA6, textA6, true);
    String stringA7 = Utils.formatHyperlink(sheet1, hlinkA7, textA7, true);
   
    String head = "<a z.t=\"";
    String href = "\" href=\"";
    String mid = "\">";
    String tail = "</a>";
   
    assertEquals(head+hlinkA1.getType()+href+hlinkA1.getAddress()+mid+textA1+tail, stringA1);
    assertEquals(head+hlinkA2.getType()+href+hlinkA2.getAddress()+mid+textA2+tail, stringA2);
    assertEquals(head+hlinkA3.getType()+href+hlinkA3.getAddress()+mid+textA3+tail, stringA3);
    assertEquals(head+hlinkA4.getType()+href+hlinkA4.getAddress()+mid+textA4+tail, stringA4);
    assertEquals(head+hlinkA5.getType()+href+hlinkA5.getAddress()+mid+textA5+tail, stringA5);
    assertEquals(head+hlinkA6.getType()+href+hlinkA6.getAddress()+mid+textA6+tail, stringA6);
    assertEquals(head+hlinkA7.getType()+href+hlinkA7.getAddress()+mid+textA7+tail, stringA7);
  }
View Full Code Here

    Row row5 = sheet1.getRow(4);
    Row row6 = sheet1.getRow(5);
   
    Cell cellA2 = row2.getCell(0);
    BookHelper.evaluate((Book)_workbook, cellA2);
    Hyperlink hlinkA1 = Utils.getHyperlink(row1.getCell(0));
    Hyperlink hlinkA2 = Utils.getHyperlink(cellA2);
    Hyperlink hlinkA3 = Utils.getHyperlink(row3.getCell(0));
    Hyperlink hlinkA4 = Utils.getHyperlink(row4.getCell(0));
    Hyperlink hlinkA5 = Utils.getHyperlink(row5.getCell(0));
    Hyperlink hlinkA6 = Utils.getHyperlink(row6.getCell(0));
   
    String stringA1 = Utils.formatHyperlink(sheet1, hlinkA1, "", true);
    String stringA2 = Utils.formatHyperlink(sheet1, hlinkA2, "", true);
    String stringA3 = Utils.formatHyperlink(sheet1, hlinkA3, "", true);
    String stringA4 = Utils.formatHyperlink(sheet1, hlinkA4, "", true);
    String stringA5 = Utils.formatHyperlink(sheet1, hlinkA5, "", true);
    String stringA6 = Utils.formatHyperlink(sheet1, hlinkA6, "", true);
   
    String head = "<a z.t=\"";
    String href = "\" href=\"";
    String mid = "\">";
    String tail = "</a>";
   
    assertEquals(head+hlinkA1.getType()+href+hlinkA1.getAddress()+mid+hlinkA1.getLabel()+tail, stringA1);
    assertEquals(head+hlinkA2.getType()+href+hlinkA2.getAddress()+mid+hlinkA2.getLabel()+tail, stringA2);
    assertEquals(head+hlinkA3.getType()+href+hlinkA3.getAddress()+mid+hlinkA3.getLabel()+tail, stringA3);
    assertEquals(head+hlinkA4.getType()+href+hlinkA4.getAddress()+mid+hlinkA4.getLabel()+tail, stringA4);
    assertEquals(head+hlinkA5.getType()+href+hlinkA5.getAddress()+mid+hlinkA5.getLabel()+tail, stringA5);
    assertEquals(head+hlinkA6.getType()+href+hlinkA6.getAddress()+mid+hlinkA6.getLabel()+tail, stringA6);
  }
View Full Code Here

          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);
      }
    }
    return text;
View Full Code Here

TOP

Related Classes of org.zkoss.poi.ss.usermodel.Hyperlink

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.