org.apache.poi.hssf.usermodel.HSSFSheet.findCellCommentLocations()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(112)

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

HSSFSheet.findCellCommentLocations介绍

[英]Finds all cell comments in this sheet and adds them to the specified locations map
[中]查找此工作表中的所有单元格注释,并将其添加到指定的位置映射中

代码示例

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

/**
 * Returns all cell comments on this sheet.
 * @return A map of each Comment in the sheet, keyed on the cell address where
 * the comment is located.
 */
@Override
public Map<CellAddress, HSSFComment> getCellComments() {
  HSSFPatriarch patriarch = getDrawingPatriarch();
  if (null == patriarch) {
    patriarch = createDrawingPatriarch();
  }
  
  Map<CellAddress, HSSFComment> locations = new TreeMap<>();
  findCellCommentLocations(patriarch, locations);
  return locations;
}
/**

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

/**
 * Finds all cell comments in this sheet and adds them to the specified locations map
 *
 * @param container a container that may contain HSSFComments
 * @param locations the map to store the HSSFComments in
 */
private void findCellCommentLocations(HSSFShapeContainer container, Map<CellAddress, HSSFComment> locations) {
  for (Object object : container.getChildren()) {
    HSSFShape shape = (HSSFShape) object;
    if (shape instanceof HSSFShapeGroup) {
      findCellCommentLocations((HSSFShapeGroup) shape, locations);
      continue;
    }
    if (shape instanceof HSSFComment) {
      HSSFComment comment = (HSSFComment) shape;
      if (comment.hasPosition()) {
        locations.put(new CellAddress(comment.getRow(), comment.getColumn()), comment);
      }
    }
  }
}

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

/**
 * Returns all cell comments on this sheet.
 * @return A map of each Comment in the sheet, keyed on the cell address where
 * the comment is located.
 */
@Override
public Map<CellAddress, HSSFComment> getCellComments() {
  HSSFPatriarch patriarch = getDrawingPatriarch();
  if (null == patriarch) {
    patriarch = createDrawingPatriarch();
  }
  
  Map<CellAddress, HSSFComment> locations = new TreeMap<>();
  findCellCommentLocations(patriarch, locations);
  return locations;
}
/**

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

/**
 * Finds all cell comments in this sheet and adds them to the specified locations map
 *
 * @param container a container that may contain HSSFComments
 * @param locations the map to store the HSSFComments in
 */
private void findCellCommentLocations(HSSFShapeContainer container, Map<CellAddress, HSSFComment> locations) {
  for (Object object : container.getChildren()) {
    HSSFShape shape = (HSSFShape) object;
    if (shape instanceof HSSFShapeGroup) {
      findCellCommentLocations((HSSFShapeGroup) shape, locations);
      continue;
    }
    if (shape instanceof HSSFComment) {
      HSSFComment comment = (HSSFComment) shape;
      if (comment.hasPosition()) {
        locations.put(new CellAddress(comment.getRow(), comment.getColumn()), comment);
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多

HSSFSheet类方法