Пример #1
0
  /**
   * @param txt
   * @param style
   * @param info
   * @param fieldType
   * @param isField
   */
  protected void writeSpan(
      String txt, StyleEntry style, HyperlinkInfo info, int fieldType, boolean isField) {
    writer.openTag("text:span");
    if (style != null && style.getType() == StyleConstant.TYPE_TEXT) {
      writer.attribute("text:style-name", style.getName());
    }
    // inline style for hyperlinks
    else if (info != null && info.getStyle() != null) {
      writer.attribute("text:style-name", info.getStyle().getName());
    }

    if (isField) {
      writeAutoText(fieldType);
    } else {
      writeString(txt);
    }
    writer.closeTag("text:span");
  }
Пример #2
0
  protected void openHyperlink(HyperlinkInfo info, String baseType) {
    if (info == null) {
      return;
    }

    writer.openTag(baseType + ":a");

    writer.attribute("xlink:type", "simple");
    if (HyperlinkInfo.BOOKMARK == info.getType()) {
      writer.attribute("xlink:href", "#" + info.getUrl());
    } else if (HyperlinkInfo.HYPERLINK == info.getType() || HyperlinkInfo.DRILL == info.getType()) {
      writer.attribute("xlink:href", info.getUrl());
    }
    if (info.getTooltip() != null) {
      writer.attribute("xlink:title", info.getTooltip());
    }
  }