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

📄 sheetitem.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
package net.aetherial.gis.jiaotongbu.outputJTB.txtOutput.module.excel;

import jxl.Sheet;
import java.io.File;
import java.io.IOException;
import jxl.read.biff.BiffException;
import net.aetherial.gis.jiaotongbu.input.publicuse.Item;
import jxl.Workbook;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class SheetItem {
  private Sheet sheet_xianzhen = null;
  private Sheet sheet_jianzhicun = null;
  private Sheet sheet_adder = null;
  private Sheet sheet_ql = null;
  private Sheet sheet_sd = null;
  private Sheet sheet_dk = null;
  private Sheet sheet_xzjj = null; //乡镇交界表
  private Sheet sheet_hdld = null; //核对路段表
  /**
   * 行数
   */
  private int t1_xiangzhen_rows = 0;
  public SheetItem() {
  }

  /**
   * 通过给予"乡镇"文件的路径,
   * 将私有的"乡镇"Sheet赋值
   */
  public void setXiangzhen(String xiangzhenFile) {
    this.sheet_xianzhen = this.getSheet(xiangzhenFile, Property.t1_SheetName);
    this.t1_xiangzhen_rows = this.sheet_xianzhen.getRows();

  }

  public void setQiaoLiang(String xiangzhenFile) {
    this.sheet_ql = this.getSheet(xiangzhenFile, Property.t3_SheetName);
    try {
      this.t1_xiangzhen_rows = this.sheet_ql.getRows();
    }
    catch (Exception ex) {
    }

  }
  public void setHeduiLuduan(String luduanBiaoFile) {
    this.sheet_hdld = this.getSheet(luduanBiaoFile, Property.heduiLuduan_SheetName);
    if (this.sheet_hdld == null) {
      this.sheet_hdld = this.getSheet(luduanBiaoFile, 0);
    }
    this.t1_xiangzhen_rows = this.sheet_hdld.getRows();

  }
  public void setHeduiQiaoLiang(String qiaoliangFile) {
      this.sheet_ql = this.getSheet(qiaoliangFile, Property.t3_SheetName);
      this.t1_xiangzhen_rows = this.sheet_ql.getRows();

  }

  public void setSuiDao(String xiangzhenFile) {
    this.sheet_sd = this.getSheet(xiangzhenFile, Property.t4_SheetName);
    this.t1_xiangzhen_rows = this.sheet_sd.getRows();
  }

  public void setDuKou(String xiangzhenFile) {
    this.sheet_dk = this.getSheet(xiangzhenFile, Property.t5_SheetName);
    this.t1_xiangzhen_rows = this.sheet_dk.getRows();

  }

  public void setGljQiaoliang(String qiaoliangfile) {
    this.sheet_ql = this.getSheet(qiaoliangfile, Property.t3_SheetName);
    this.t1_xiangzhen_rows = this.sheet_dk.getRows();

  }

  public void setQiaoliangFangxiang(String qiaoliangfile) throws Exception{
    this.sheet_ql = this.getSheet(qiaoliangfile, Property.t7_Hedui_SheetName);
    this.t1_xiangzhen_rows = this.sheet_ql.getRows();
  }


  /**
   * 通过给予"填报人员"文件的路径,
   * 将私有的"填报人员"Sheet赋值
   */
  public void setAdder(String adderFile) {
    this.sheet_adder = this.getSheet(adderFile, Property.t7_SheetName);
//   this.sheet_adder_rows  = this.sheet_xianzhen.getRows();
  }

  /**
   * 通过给予"建制村"文件的路径,
   * 将私有的"建制村"Sheet赋值
   */
  public void setJianzhicun(String jianzhicunFile) {
    this.sheet_jianzhicun = this.getSheet(jianzhicunFile, Property.t2_SheetName);
    this.t1_xiangzhen_rows = this.sheet_jianzhicun.getRows();
//   this.sheet_jianzhicun = this.getSheet(jianzhicunFile,"建制村");
  }

  /**
   * 通过给予"乡镇交界表"文件的路径,
   * 将私有的"乡镇交界表"Sheet赋值
   */
  public void setXZJJ(String xzjjFile) {
    this.sheet_xzjj = this.getSheet(xzjjFile, Property.t8_SheetName);
    this.t1_xiangzhen_rows = this.sheet_xzjj.getRows();
  }

  /**
   * 得到"乡镇"的Sheet
   */
  public Sheet getXiangzhenSheet() {
    return this.sheet_xianzhen;
  }

  /**
   * 得到"填报人员"的Sheet
   */
  public Sheet getAdderSheet() {
    return this.sheet_adder;
  }

  /**
   * 得到"乡镇交界表"的Sheet
   */
  public Sheet getXZJJSheet() {
    return this.sheet_xzjj;
  }

  public Sheet getSheet_hdld(){
    return this.sheet_hdld;
  }

  /**
   * 得到"建制村"的Sheet
   */
  public Sheet getJianzhicunSheet() {
    return this.sheet_jianzhicun;
  }

  public int getT1_XiangzhenRows() {
    return this.t1_xiangzhen_rows;
  }

  public int getT2_JianzhicunRows() {
    return this.t1_xiangzhen_rows;
  }

  private Sheet getSheet(String fileName, String sheetName) {
    Workbook workbook = null;
    try {
      workbook = Workbook.getWorkbook(new File(fileName));
    }
    catch (BiffException ex) {
      System.err.println(ex.getMessage() +
          " in Item.getSheet(String fileName,String sheetName) BiffException");
    }
    catch (IOException ex) {
      System.err.println(ex.getMessage() +
          " in Item.getSheet(String fileName,String sheetName) IOException");
    }
    if (workbook != null) {
      return workbook.getSheet(sheetName);
    }
    else {
      return null;
    }
  }

  private Sheet getSheet(String fileName, int id) {
    Workbook workbook = null;
    try {
      workbook = Workbook.getWorkbook(new File(fileName));
    }
    catch (BiffException ex) {
      System.err.println(ex.getMessage() +
          " in Item.getSheet(String fileName,String sheetName) BiffException");
    }
    catch (IOException ex) {
      System.err.println(ex.getMessage() +
          " in Item.getSheet(String fileName,String sheetName) IOException");
    }
    if (workbook != null) {
      return workbook.getSheet(id);
    }
    else {
      return null;
    }
  }


  public Sheet getSheet_sd() {
    return sheet_sd;
  }

  public Sheet getSheet_ql() {
    return sheet_ql;
  }

  public Sheet getSheet_dk() {
    return sheet_dk;
  }

}

⌨️ 快捷键说明

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