gpt4 book ai didi

org.apache.poi.xssf.usermodel.XSSFHyperlink类的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 08:13:05 32 4
gpt4 key购买 nike

本文整理了Java中org.apache.poi.xssf.usermodel.XSSFHyperlink类的一些代码示例,展示了XSSFHyperlink类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSSFHyperlink类的具体详情如下:
包路径:org.apache.poi.xssf.usermodel.XSSFHyperlink
类名称:XSSFHyperlink

XSSFHyperlink介绍

[英]XSSF Implementation of a Hyperlink. Note - unlike with HSSF, many kinds of hyperlink are largely stored as relations of the sheet
[中]XSSF实现了一个超链接。注意-与HSSF不同,许多类型的超链接主要存储为工作表的关系

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

@Internal
public void setCellReference(CellReference ref) {
  setCellReference(ref.formatAsString());
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Create a new XSSFHyperlink.
 *
 * @param type - the type of hyperlink to create, see {@link Hyperlink}
 */
@Override
public XSSFHyperlink createHyperlink(HyperlinkType type) {
  return new XSSFHyperlink(type);
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Return the column of the last cell that contains the hyperlink
 *
 * @return the 0-based column of the last cell that contains the hyperlink
 */
@Override
public int getLastColumn() {
  return buildCellReference().getCol();
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Set the column of the first cell that contains the hyperlink
 *
 * @param col the 0-based column of the first cell that contains the hyperlink
 */
@Override
public void setFirstColumn(int col) {
  setCellReference(new CellReference( getFirstRow(), col ));
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Set the row of the first cell that contains the hyperlink
 *
 * @param row the 0-based row of the first cell that contains the hyperlink
 */
@Override
public void setFirstRow(int row) {
  setCellReference(new CellReference( row, getFirstColumn() ));
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/*package*/ static void updateHyperlinks(Sheet sheet, FormulaShifter formulaShifter) {
  int sheetIndex = sheet.getWorkbook().getSheetIndex(sheet);
  List<? extends Hyperlink> hyperlinkList = sheet.getHyperlinkList();
  for (Hyperlink hyperlink : hyperlinkList) {
    XSSFHyperlink xhyperlink = (XSSFHyperlink) hyperlink;
    String cellRef = xhyperlink.getCellRef();
    CellRangeAddress cra = CellRangeAddress.valueOf(cellRef);
    CellRangeAddress shiftedRange = BaseRowColShifter.shiftRange(formulaShifter, cra, sheetIndex);
    if (shiftedRange != null && shiftedRange != cra) {
      // shiftedRange should not be null. If shiftedRange is null, that means
      // that a hyperlink wasn't deleted at the beginning of shiftRows when
      // identifying rows that should be removed because they will be overwritten
      xhyperlink.setCellReference(shiftedRange.formatAsString());
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

hyperlink.generateRelationIfNeeded(getPackagePart());
ctHls[i] = hyperlink.getCTHyperlink();

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Create a new XSSFHyperlink. This method is for Internal use only.
 * XSSFHyperlinks can be created by {@link XSSFCreationHelper}.
 * See the <a href="https://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks">spreadsheet quick-guide</a>
 * for an example.
 *
 * @param other the hyperlink to copy
 */
@Internal //FIXME: change to protected if/when SXSSFHyperlink class is created
public XSSFHyperlink(Hyperlink other) {
  if (other instanceof XSSFHyperlink) {
    XSSFHyperlink xlink = (XSSFHyperlink) other;
    _type = xlink.getType();
    _location = xlink._location;
    _externalRel = xlink._externalRel;
    _ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy();
  }
  else {
    _type = other.getType();
    _location = other.getAddress();
    _externalRel = null;
    _ctHyperlink = CTHyperlink.Factory.newInstance();
    setCellReference(new CellReference(other.getFirstRow(), other.getFirstColumn()));
  }
}
/**

代码示例来源:origin: dhis2/dhis2-core

hyperlink.setAddress( getValue( (SimpleNode) node ) );
hyperlink.setLabel( getValue( (SimpleNode) node ) );
hyperlink.setAddress( getValue( (SimpleNode) node ) );
hyperlink.setLabel( getValue( (SimpleNode) node ) );

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Get a Hyperlink in this sheet located in a cell specified by {code addr}
 *
 * @param addr The address of the cell containing the hyperlink
 * @return hyperlink if there is a hyperlink anchored at {@code addr}; otherwise returns {@code null}
 * @since POI 3.15 beta 3
 */
@Override
public XSSFHyperlink getHyperlink(CellAddress addr) {
  String ref = addr.formatAsString();
  for(XSSFHyperlink hyperlink : hyperlinks) {
    if(hyperlink.getCellRef().equals(ref)) {
      return hyperlink;
    }
  }
  return null;
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata2.core

private void createCellHyperLink(Cell cell, EntityInfo eInfo, Object val, XSSFWorkbook workbook) {
  CellStyle style = workbook.createCellStyle();
  Font font = workbook.createFont();
  font.setUnderline(Font.U_SINGLE);
  font.setColor(HSSFColor.BLUE.index);
  style.setFont(font);
  
  XSSFHyperlink hLink = null;
  if(EMAIL.equals(eInfo.getSemantics())){
    hLink = workbook.getCreationHelper().createHyperlink(HyperlinkType.EMAIL);
    hLink.setAddress("mailto:"+String.valueOf(val));
  }else if(URL.equals(eInfo.getSemantics())){
    hLink = workbook.getCreationHelper().createHyperlink(HyperlinkType.URL);
    hLink.setAddress(String.valueOf(val));
  }
  if(hLink != null){
    cell.setHyperlink(hLink);
    cell.setCellStyle(style);
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Generates the relation if required
 */
protected void generateRelationIfNeeded(PackagePart sheetPart) {
  if (_externalRel == null && needsRelationToo()) {
    // Generate the relation
    PackageRelationship rel =
        sheetPart.addExternalRelationship(_location, XSSFRelation.SHEET_HYPERLINKS.getRelation());
    // Update the r:id
    _ctHyperlink.setId(rel.getId());
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Set the row of the first cell that contains the hyperlink
 *
 * @param row the 0-based row of the first cell that contains the hyperlink
 */
public void setFirstRow(int row) {
  _ctHyperlink.setRef(
      new CellReference(
          row, getFirstColumn()
      ).formatAsString()
  );
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Set the column of the first cell that contains the hyperlink
 *
 * @param col the 0-based column of the first cell that contains the hyperlink
 */
public void setFirstColumn(int col) {
  _ctHyperlink.setRef(
      new CellReference(
          getFirstRow(), col
      ).formatAsString()
  );
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Assign a hyperlink to this cell
 *
 * @param link hyperlink associated with this cell
 */
public void setHyperlink(Hyperlink link)
{
  setProperty(Property.HYPERLINK,link);
  XSSFHyperlink xssfobj = (XSSFHyperlink)link;
  // Assign to us
  CellReference ref = new CellReference(getRowIndex(), getColumnIndex());
  xssfobj.getCTHyperlink().setRef( ref.formatAsString()  );
  // Add to the lists
  ((SXSSFSheet)getSheet())._sh.addHyperlink(xssfobj);
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

hyperlink.generateRelationIfNeeded(getPackagePart());
ctHls[i] = hyperlink.getCTHyperlink();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Set the column of the first cell that contains the hyperlink
 *
 * @param col the 0-based column of the first cell that contains the hyperlink
 */
@Override
public void setFirstColumn(int col) {
  setCellReference(new CellReference( getFirstRow(), col ));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Set the row of the first cell that contains the hyperlink
 *
 * @param row the 0-based row of the first cell that contains the hyperlink
 */
@Override
public void setFirstRow(int row) {
  setCellReference(new CellReference( row, getFirstColumn() ));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/*package*/ static void updateHyperlinks(Sheet sheet, FormulaShifter formulaShifter) {
  int sheetIndex = sheet.getWorkbook().getSheetIndex(sheet);
  List<? extends Hyperlink> hyperlinkList = sheet.getHyperlinkList();
  for (Hyperlink hyperlink : hyperlinkList) {
    XSSFHyperlink xhyperlink = (XSSFHyperlink) hyperlink;
    String cellRef = xhyperlink.getCellRef();
    CellRangeAddress cra = CellRangeAddress.valueOf(cellRef);
    CellRangeAddress shiftedRange = BaseRowColShifter.shiftRange(formulaShifter, cra, sheetIndex);
    if (shiftedRange != null && shiftedRange != cra) {
      // shiftedRange should not be null. If shiftedRange is null, that means
      // that a hyperlink wasn't deleted at the beginning of shiftRows when
      // identifying rows that should be removed because they will be overwritten
      xhyperlink.setCellReference(shiftedRange.formatAsString());
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Create a new XSSFHyperlink. This method is for Internal use only.
 * XSSFHyperlinks can be created by {@link XSSFCreationHelper}.
 * See the <a href="https://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks">spreadsheet quick-guide</a>
 * for an example.
 *
 * @param other the hyperlink to copy
 */
@Internal //FIXME: change to protected if/when SXSSFHyperlink class is created
public XSSFHyperlink(Hyperlink other) {
  if (other instanceof XSSFHyperlink) {
    XSSFHyperlink xlink = (XSSFHyperlink) other;
    _type = xlink.getType();
    _location = xlink._location;
    _externalRel = xlink._externalRel;
    _ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy();
  }
  else {
    _type = other.getType();
    _location = other.getAddress();
    _externalRel = null;
    _ctHyperlink = CTHyperlink.Factory.newInstance();
    setCellReference(new CellReference(other.getFirstRow(), other.getFirstColumn()));
  }
}
/**

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com