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

📄 readcolumn.txt

📁 jxl是一个开源项目
💻 TXT
字号:
package org.eclipseguide.hwcstj;

import java.io.FileInputStream;
import java.io.InputStream;

import jxl.Workbook;
import jxl.Sheet;
import jxl.LabelCell;
import jxl.Cell;
import jxl.CellType;

public class ReadColumn {

    /**
     * @param args
     */
    public ReadColumn() {
    }
    public void Read(String excelFileName){
        Workbook rwb = null;
        InputStream stream = null;
        try{
            stream = new FileInputStream(excelFileName);
            rwb = Workbook.getWorkbook(stream);
            Sheet sheet = null;
            Cell cell = null;
            sheet = rwb.getSheet(0);
            int rows = sheet.getRows();
            int columns = sheet.getColumns();
            for (int j = 0; j < rows; j++) {
                columns = sheet.getRow(0).length;
                for (int k = 0; k <columns; k++) {
                  cell = sheet.getCell(k, j);
                  String strContents = cell.getContents();
                  if(k==2)
                  
                      System.out.println("cell["+ k + "," + j + "] ==" + strContents);

                  }
            }
        }catch(Exception ex){
          ex.printStackTrace();
        } finally {
            rwb.close();
            try {
              stream.close();
            } catch (Exception ex) {
                ex.printStackTrace();
              }
            }
        }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        ReadColumn test = new ReadColumn();
        test.Read("C:\\Documents and Settings\\Administrator.EOMS\\My Documents\\HK\\话务网管系统相关缩略语.xls");
    }

}

⌨️ 快捷键说明

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