⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xlsrowcursorimpl.java

📁 一个java生成自动生成Excel
💻 JAVA
字号:
package net.sf.jxls.reader;

import java.util.NoSuchElementException;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;

/**
 * @author Leonid Vysochyn
 */
public class XLSRowCursorImpl implements XLSRowCursor {
    int currentRowNum;
    HSSFSheet sheet;
    String sheetName;


    public XLSRowCursorImpl(HSSFSheet sheet) {
        this.sheet = sheet;
    }


    public XLSRowCursorImpl(String sheetName, HSSFSheet sheet) {
        this.sheetName = sheetName;
        this.sheet = sheet;
    }

    public int getCurrentRowNum() {
        return currentRowNum;
    }

    public HSSFRow getCurrentRow() {
        return sheet.getRow( currentRowNum );
    }


    public HSSFSheet getSheet() {
        return sheet;
    }

    public void setSheet(HSSFSheet sheet) {
        this.sheet = sheet;
    }

    public String getSheetName() {
        return sheetName;
    }

    public void setSheetName(String sheetName) {
        this.sheetName = sheetName;
    }

    public HSSFRow next() {
        if( hasNext() ){
            return sheet.getRow( currentRowNum++ );
        }
        throw new NoSuchElementException();
    }

    public boolean hasNext() {
        return (currentRowNum <= sheet.getLastRowNum());
    }

    public void reset() {
        currentRowNum = 0;
    }

    public void setCurrentRowNum(int rowNum) {
        currentRowNum = rowNum;
    }

    public void moveForward() {
        currentRowNum++;
    }

    public void moveBackward() {
        currentRowNum--;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -