item.java

来自「基于Java的地图数据管理软件。使用MySQL数据库管理系统。」· Java 代码 · 共 67 行

JAVA
67
字号
package net.aetherial.gis.jiaotongbu.input.publicuse;

import jxl.Sheet;
import java.io.File;
import java.io.IOException;
import jxl.read.biff.BiffException;
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 Item {
  private static Sheet sheet_xianzhen = null;
  private static Sheet sheet_jianzhicun = null;
  public Item() {
  }

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

  public static Sheet getXiangzhenSheet(){
    return Item.sheet_xianzhen;
  }

  public static void setJianzhicun(String jianzhicunFile){
    Item.sheet_jianzhicun = Item.getSheet(jianzhicunFile,"建制村");
  }

  public static Sheet getJianzhicunSheet(){
    return Item.sheet_jianzhicun;
  }


  private static 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;
    }
  }

}

⌨️ 快捷键说明

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