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

📄 hssftotalwrapper.java

📁 一个完整的表格展示数据查询的工具,可以直接在eclipse中编辑使用.
💻 JAVA
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-6-14 13:30:26
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   HssfTotalWrapper.java

package org.displaytag.sample.decorators;

import org.apache.poi.hssf.usermodel.*;
import org.displaytag.decorator.hssf.DecoratesHssf;

// Referenced classes of package org.displaytag.sample.decorators:
//            TotalWrapperTemplate

public class HssfTotalWrapper extends TotalWrapperTemplate
    implements DecoratesHssf
{

    public HssfTotalWrapper()
    {
    }

    protected void writeCityTotal(String city, double total)
    {
        writeTotal(city, total);
    }

    private void writeTotal(String value, double total)
    {
        if(assertRequiredState())
        {
            int rowNum = sheet.getLastRowNum();
            currentRow = sheet.createRow(++rowNum);
            colNum = 0;
            prepareCell();
            prepareCell();
            prepareCell();
            currentCell.setCellValue("------------");
            currentRow = sheet.createRow(++rowNum);
            colNum = 0;
            prepareCell();
            prepareCell();
            currentCell.setCellValue(value + " Total:");
            prepareCell();
            currentCell.setCellValue(total);
        }
    }

    private void prepareCell()
    {
        currentCell = currentRow.createCell((short)(colNum++));
        currentCell.setEncoding((short)1);
    }

    protected void writeGrandTotal(double total)
    {
        writeTotal("Grand", total);
    }

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

    private boolean assertRequiredState()
    {
        return sheet != null;
    }

    private HSSFSheet sheet;
    private HSSFCell currentCell;
    private HSSFRow currentRow;
    private int colNum;
}

⌨️ 快捷键说明

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