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

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

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

HSSFWorkbook.updateNamedRangesAfterSheetReorder介绍

[英]copy-pasted from XSSFWorkbook#updateNamedRangesAfterSheetReorder(int, int) update sheet-scoped named ranges in this workbook after changing the sheet order of a sheet at oldIndex to newIndex. Sheets between these indices will move left or right by 1.
[中]从XSSF工作簿复制粘贴#UpdateNamedRangeSheetrOrder(int,int)将oldIndex处工作表的工作表顺序更改为newIndex后,更新此工作簿中工作表范围内的命名范围。这些索引之间的图纸将向左或向右移动1。

代码示例

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

/**
 * sets the order of appearance for a given sheet.
 *
 * @param sheetname the name of the sheet to reorder
 * @param pos the position that we want to insert the sheet into (0 based)
 */
@Override
public void setSheetOrder(String sheetname, int pos ) {
  int oldSheetIndex = getSheetIndex(sheetname);
  _sheets.add(pos,_sheets.remove(oldSheetIndex));
  workbook.setSheetOrder(sheetname, pos);
  FormulaShifter shifter = FormulaShifter.createForSheetShift(oldSheetIndex, pos);
  for (HSSFSheet sheet : _sheets) {
    sheet.getSheet().updateFormulasAfterCellShift(shifter, /* not used */ -1 );
  }
  workbook.updateNamesAfterCellShift(shifter);
  updateNamedRangesAfterSheetReorder(oldSheetIndex, pos);
  
  updateActiveSheetAfterSheetReorder(oldSheetIndex, pos);
}

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

/**
 * sets the order of appearance for a given sheet.
 *
 * @param sheetname the name of the sheet to reorder
 * @param pos the position that we want to insert the sheet into (0 based)
 */
@Override
public void setSheetOrder(String sheetname, int pos ) {
  int oldSheetIndex = getSheetIndex(sheetname);
  _sheets.add(pos,_sheets.remove(oldSheetIndex));
  workbook.setSheetOrder(sheetname, pos);
  FormulaShifter shifter = FormulaShifter.createForSheetShift(oldSheetIndex, pos);
  for (HSSFSheet sheet : _sheets) {
    sheet.getSheet().updateFormulasAfterCellShift(shifter, /* not used */ -1 );
  }
  workbook.updateNamesAfterCellShift(shifter);
  updateNamedRangesAfterSheetReorder(oldSheetIndex, pos);
  
  updateActiveSheetAfterSheetReorder(oldSheetIndex, pos);
}

相关文章

HSSFWorkbook类方法