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

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

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

HSSFWorkbook.setActiveSheet介绍

[英]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.
[中]

代码示例

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

  1. private void updateActiveSheetAfterSheetReorder(int oldIndex, int newIndex) {
  2. // adjust active sheet if necessary
  3. int active = getActiveSheetIndex();
  4. if(active == oldIndex) {
  5. // moved sheet was the active one
  6. setActiveSheet(newIndex);
  7. } else if ((active < oldIndex && active < newIndex) ||
  8. (active > oldIndex && active > newIndex)) {
  9. // not affected
  10. } else if (newIndex > oldIndex) {
  11. // moved sheet was below before and is above now => active is one less
  12. setActiveSheet(active-1);
  13. } else {
  14. // remaining case: moved sheet was higher than active before and is lower now => active is one more
  15. setActiveSheet(active+1);
  16. }
  17. }

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

  1. if(active == index) {
  2. setActiveSheet(newSheetIndex);
  3. } else if (active > index) {
  4. setActiveSheet(active-1);

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

  1. private void updateActiveSheetAfterSheetReorder(int oldIndex, int newIndex) {
  2. // adjust active sheet if necessary
  3. int active = getActiveSheetIndex();
  4. if(active == oldIndex) {
  5. // moved sheet was the active one
  6. setActiveSheet(newIndex);
  7. } else if ((active < oldIndex && active < newIndex) ||
  8. (active > oldIndex && active > newIndex)) {
  9. // not affected
  10. } else if (newIndex > oldIndex) {
  11. // moved sheet was below before and is above now => active is one less
  12. setActiveSheet(active-1);
  13. } else {
  14. // remaining case: moved sheet was higher than active before and is lower now => active is one more
  15. setActiveSheet(active+1);
  16. }
  17. }

代码示例来源:origin: stackoverflow.com

  1. HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(file));
  2. HSSFSheet s = wb.getSheetAt(0);
  3. wb.setActiveSheet(0);
  4. s.showInPane(0, 0);
  5. FileOutputStream out = new FileOutputStream(file);
  6. wb.write(out);
  7. out.close();

代码示例来源:origin: stackoverflow.com

  1. wb.setActiveSheet(0);
  2. BufferedImage img = null;
  3. try {

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

  1. if(active == index) {
  2. setActiveSheet(newSheetIndex);
  3. } else if (active > index) {
  4. setActiveSheet(active-1);

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

  1. setActiveSheet(newSheetIndex);

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

  1. setActiveSheet(newSheetIndex);

相关文章

HSSFWorkbook类方法