mocksheetcellfinder.java

来自「一个java生成自动生成Excel」· Java 代码 · 共 39 行

JAVA
39
字号
package net.sf.jxls;

import java.util.List;
import java.util.Map;

import net.sf.jxls.controller.SheetCellFinder;

import org.apache.poi.hssf.util.CellReference;

/**
 * @author Leonid Vysochyn
 */
public class MockSheetCellFinder implements SheetCellFinder {

    Map cellsMapping;

    public MockSheetCellFinder(Map cellsMapping) {
        this.cellsMapping = cellsMapping;
    }

    public List findCell(String cellName) {
        return (List) cellsMapping.get( cellName );
    }

    public List findCell(int rowNum, int colNum) {
        CellReference cellReference = new CellReference( rowNum, colNum );
        return (List) cellsMapping.get( cellReference.toString() );
    }

    public List findCell(String sheetName, String cellName) {
        return (List) cellsMapping.get( cellName );
    }

    public List findCell(String sheetName, int rowNum, int colNum) {
        CellReference cellReference = new CellReference( rowNum, colNum );
        return (List) cellsMapping.get( cellReference.toString() );
    }
}

⌨️ 快捷键说明

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