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

📄 baserowtransformer.java

📁 一个java生成自动生成Excel
💻 JAVA
字号:
package net.sf.jxls.transformer;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import net.sf.jxls.formula.ListRange;import net.sf.jxls.parser.Cell;import net.sf.jxls.processor.CellProcessor;import net.sf.jxls.tag.Block;import net.sf.jxls.util.FormulaUtil;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/** * Base class for {@link RowTransformer} impelementations * @author Leonid Vysochyn */public abstract class BaseRowTransformer implements RowTransformer{    protected final Log log = LogFactory.getLog(getClass());    /**     * {@link net.sf.jxls.transformer.Configuration} class     */    private Configuration configuration;    /**     * This list is used to store formula cells information while processing template file     */    private List formulas = new ArrayList();    /**     * This variable stores all list ranges found while processing template file     */    private Map listRanges = new HashMap();    /**     * Stores all named HSSFCell objects     */    private Map namedCells = new HashMap();    private List cellProcessors = new ArrayList();    Row row;    public Row getRow() {        return row;    }    /**     * Adds new {@link net.sf.jxls.formula.ListRange} to the map of ranges and updates formulas if there is range with the same name already     *     * @param sheet     Sheet to process     * @param rangeName The name of {@link net.sf.jxls.formula.ListRange} to add     * @param range     actual {@link net.sf.jxls.formula.ListRange} to add     * @return true if a range with such name already exists or false if not     */    protected boolean addListRange(Sheet sheet, String rangeName, ListRange range) {        if (listRanges.containsKey(rangeName)) {            // update all formulas that can be updated and remove them from formulas list ( ignore all others )            FormulaUtil.updateFormulas(sheet.getHssfSheet(), formulas, listRanges, namedCells, true);            listRanges.put(rangeName, range);            return true;        }        listRanges.put(rangeName, range);        return false;    }    /**     * Applies all registered CellProcessors to a cell     *     * @param cell - {@link net.sf.jxls.parser.Cell} object with cell information     */    protected void applyCellProcessors(Cell cell) {        for (int i = 0; i < cellProcessors.size(); i++) {            CellProcessor cellProcessor = (CellProcessor) cellProcessors.get(i);            cellProcessor.processCell(cell, namedCells);        }    }    public Block getTransformationBlock(){        return null;    }    public void setTransformationBlock(Block block) {    }}

⌨️ 快捷键说明

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