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

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

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

HSSFWorkbook.validateSheetIndex介绍

暂无

代码示例

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

/**
 * Get the HSSFSheet object at the given index.
 * @param index of the sheet number (0-based physical & logical)
 * @return HSSFSheet at the provided index
 * @throws IllegalArgumentException if the index is out of range (index
 *            < 0 || index >= getNumberOfSheets()).
 */
@Override
public HSSFSheet getSheetAt(int index)
{
  validateSheetIndex(index);
  return _sheets.get(index);
}

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

/**
 * @return Sheet name for the specified index
 */
@Override
public String getSheetName(int sheetIndex) {
  validateSheetIndex(sheetIndex);
  return workbook.getSheetName(sheetIndex);
}

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

@Override
public boolean isSheetHidden(int sheetIx) {
  validateSheetIndex(sheetIx);
  return workbook.isSheetHidden(sheetIx);
}

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

@Override
public boolean isSheetVeryHidden(int sheetIx) {
  validateSheetIndex(sheetIx);
  return workbook.isSheetVeryHidden(sheetIx);
}

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

@Override
public void setSheetVisibility(int sheetIx, SheetVisibility visibility) {
  validateSheetIndex(sheetIx);
  workbook.setSheetHidden(sheetIx, visibility);
}

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

/**
 * Set the sheet name.
 *
 * @param sheetIx number (0 based)
 * @throws IllegalArgumentException if the name is null or invalid
 *  or workbook already contains a sheet with this name
 * @see #createSheet(String)
 * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)
 */
@Override
public void setSheetName(int sheetIx, String name) {
  if (name == null) {
    throw new IllegalArgumentException("sheetName must not be null");
  }
  if (workbook.doesContainsSheetName(name, sheetIx)) {
    throw new IllegalArgumentException("The workbook already contains a sheet named '" + name + "'");
  }
  validateSheetIndex(sheetIx);
  workbook.setSheetName(sheetIx, name);
}

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

/**
 * Selects multiple sheets as a group. This is distinct from
 * the 'active' sheet (which is the sheet with focus).
 * Unselects sheets that are not in <code>indexes</code>.
 *
 * @param indexes Collection of sheets to select, the index is 0-based.
 */
public void setSelectedTabs(Collection<Integer> indexes) {
  for (int index : indexes) {
    validateSheetIndex(index);
  }
  // ignore duplicates
  Set<Integer> set = new HashSet<>(indexes);
  int nSheets = _sheets.size();
  for (int i=0; i<nSheets; i++) {
    boolean bSelect = set.contains(i);
    getSheetAt(i).setSelected(bSelect);
  }
  // this is true only if all values in set were valid sheet indexes (between 0 and nSheets-1, inclusive)
  short nSelected = (short) set.size();
  workbook.getWindowOne().setNumSelectedTabs(nSelected);
}

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

/**
 * Selects a single sheet. This may be different to
 * the 'active' sheet (which is the sheet with focus).
 */
@Override
public void setSelectedTab(int index) {
  validateSheetIndex(index);
  int nSheets = _sheets.size();
  for (int i=0; i<nSheets; i++) {
      getSheetAt(i).setSelected(i == index);
  }
  workbook.getWindowOne().setNumSelectedTabs((short)1);
}

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

/**
 * Convenience method to set the active sheet.  The active sheet is is the sheet
 * which is currently displayed when the workbook is viewed in Excel.
 * 'Selected' sheet(s) is a distinct concept.
 */
@Override
public void setActiveSheet(int index) {
  validateSheetIndex(index);
  int nSheets = _sheets.size();
  for (int i=0; i<nSheets; i++) {
     getSheetAt(i).setActive(i == index);
  }
  workbook.getWindowOne().setActiveSheetIndex(index);
}

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

validateSheetIndex(sheetIndex);
HSSFSheet srcSheet = _sheets.get(sheetIndex);
String srcName = workbook.getSheetName(sheetIndex);

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

validateSheetIndex(index);
boolean wasSelected = getSheetAt(index).isSelected();

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * Get the HSSFSheet object at the given index.
 * @param index of the sheet number (0-based physical & logical)
 * @return HSSFSheet at the provided index
 */
public HSSFSheet getSheetAt(int index)
{
  validateSheetIndex(index);
  return (HSSFSheet) _sheets.get(index);
}

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

@Override
public void setSheetVisibility(int sheetIx, SheetVisibility visibility) {
  validateSheetIndex(sheetIx);
  workbook.setSheetHidden(sheetIx, visibility);
}

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

/**
 * @return Sheet name for the specified index
 */
@Override
public String getSheetName(int sheetIndex) {
  validateSheetIndex(sheetIndex);
  return workbook.getSheetName(sheetIndex);
}

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

@Override
public boolean isSheetHidden(int sheetIx) {
  validateSheetIndex(sheetIx);
  return workbook.isSheetHidden(sheetIx);
}

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

@Override
public boolean isSheetVeryHidden(int sheetIx) {
  validateSheetIndex(sheetIx);
  return workbook.isSheetVeryHidden(sheetIx);
}

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

/**
 * @return Sheet name for the specified index
 */
public String getSheetName(int sheetIndex) {
  validateSheetIndex(sheetIndex);
  return workbook.getSheetName(sheetIndex);
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * @return Sheet name for the specified index
 */
public String getSheetName(int sheetIndex) {
  validateSheetIndex(sheetIndex);
  return workbook.getSheetName(sheetIndex);
}

代码示例来源:origin: com.haulmont.thirdparty/poi

public void setSheetHidden(int sheetIx, int hidden) {
  validateSheetIndex(sheetIx);
  WorkbookUtil.validateSheetState(hidden);
  workbook.setSheetHidden(sheetIx, hidden);
}

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

public void setSheetHidden(int sheetIx, int hidden) {
  validateSheetIndex(sheetIx);
  WorkbookUtil.validateSheetState(hidden);
  workbook.setSheetHidden(sheetIx, hidden);
}

相关文章

HSSFWorkbook类方法