就是excel是用什么符号来进行分列的

解决方案 »

  1.   

    不是很清楚lz意思,不是可以直接读取指定列的内容吗
    http://www.blogjava.net/caihualin/archive/2008/05/12/164724.html
    看看这个
      

  2.   

    这么高的分,竟然说不清楚问题?java没有自带处理Excel的包和对象,通常处理Excel时,使用 jxl或poi,我一般用JXL,使用很简单。自己可以到网上搜一下下载,有一个很简单的教程,不过要深入研究,必须得看API文档。
      

  3.   

    http://topic.csdn.net/u/20090912/18/fd13f02f-b2e3-4552-9344-2f67c82fb7cf.html 
     
      

  4.   

    jxl操作excel
    // Label(列号,行号 ,内容)
    // Label(列号,行号 ,内容,格式)public static void main(String[] args){
    String targetfile = "D:\\out.xls";// 输出文件名
    WritableWorkbook workbook = null;
    System.out.println("begin");
    try{
    // Excel获得文件
    Workbook wb = Workbook.getWorkbook(new File(targetfile));
    // 打开一个文件的副本,并且指定数据写回到原文件
    workbook = Workbook.createWorkbook(new File("D:\\out.xls"),wb);
    WritableSheet sheet = workbook.getSheet(0);
    // 添加带有字体颜色,带背景颜色 Formatting的对象
    jxl.write.WritableFont wfc =
    new jxl.write.WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD,false,
    jxl.format.UnderlineStyle.NO_UNDERLINE,jxl.format.Colour.BLUE);
    jxl.write.WritableCellFormat wcfFC = new jxl.write.WritableCellFormat(wfc);
    wcfFC.setBackground(jxl.format.Colour.RED);
    // Label(列号,行号 ,内容,格式) 列号和行号都是从0开始
    jxl.write.Label labelCFC = new jxl.write.Label(3,3,"Hello World",wcfFC); // B6
    sheet.addCell(labelCFC);
    //Label(列号,行号,内容)
    Label label = new Label(5,3,"hello world");
    sheet.addCell(label);
    workbook.write();
    workbook.close();
    System.out.println("end");
    }catch(Exception e){
    e.printStackTrace();
    }
    }
      

  5.   

    public static String fileToBeRead="e://test.xls";
    public static void main(String argv[])
    {
    try
    {
    HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(fileToBeRead));
    HSSFSheet sheet = workbook.getSheet("Sheet1");
    int rows = sheet.getPhysicalNumberOfRows();
    for (int r = 0; r < rows; r++)
    {
    HSSFRow row = sheet.getRow(r);
    if (row != null)
    {
    int cells = row.getPhysicalNumberOfCells();
    String value = "";
    System.out.println(cells);
    for (short c = 0; c < cells; c++) 
    {
    HSSFCell cell = row.getCell(c);
    if (cell != null)
    {
    switch (cell.getCellType())
    {
    case HSSFCell.CELL_TYPE_FORMULA :
    //strCell = String.valueOf(aCell.getNumericCellValue());
    //returnstr+=strCell+" ";
    break;
    case HSSFCell.CELL_TYPE_NUMERIC:
    value += (long)cell.getNumericCellValue()+"t";
    break;
    case HSSFCell.CELL_TYPE_STRING:
    value += cell.getStringCellValue()+"t";
    break;
    case HSSFCell.CELL_TYPE_BLANK://blank
    //strCell = aCell.getStringCellValue();
    //returnstr+=strCell+" ";
    break;
    default:
    value +="t";
    }
    }
    }
    //下面可以将查找到的行内容用SQL语句INSERT到oracle
    System.out.println(value);
    //
    }
    }
    }catch(Exception e)
    {System.out.println(e);}
    }
      

  6.   

    一般使用jxlimport java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.HashMap;
    import jxl.Cell;
    import jxl.Sheet;
    import jxl.Workbook;
    import jxl.read.biff.BiffException;
    import org.apache.struts.upload.FormFile;
    /**
     * @author Hay Vanpull
     * 
     */
    public class JXLTOOL
    {
        private Workbook                workbook   = null; // 工作部对象
                                                           
        private HashMap<String, String> mapData    = null; // data数据
                                                           
        private Sheet                   sheet      = null; // 工作表
                                                           
        public int                      totalRows  = 0;   // 总行数
                                                           
        public int                      totalCells = 0;   // 总列数
                                                           
        /**
         * 以一个InputStream为参数的构造器
         * 
         * @param inputStream
         * @throws IOException
         * @throws BiffException
         */
        public JXLTOOL(InputStream inputStream) throws BiffException, IOException
        {
            this.workbook = Workbook.getWorkbook(inputStream);
            this.sheet = this.workbook.getSheet(0);
            this.getRows();
            this.getCells();
        }
        
        /**
         * 以一个Struts FormFile为参数的构造器
         * 
         * @param file
         * @throws IOException
         * @throws FileNotFoundException
         * @throws BiffException
         */
        public JXLTOOL(FormFile file) throws FileNotFoundException, IOException,
                BiffException
        {
            this(file.getInputStream());
        }
        
        /**
         * 以一个File为参数的构造器
         * 
         * @param file
         * @throws IOException
         * @throws BiffException
         */
        public JXLTOOL(File file) throws BiffException, IOException
        {
            this(new FileInputStream(file));
        }
        
        /**
         * 以一个文件路径path的构造器
         * 
         * @param filePath
         * @throws IOException
         * @throws BiffException
         */
        public JXLTOOL(String filePath) throws BiffException, IOException
        {
            
            this(new File(filePath));
        }
        
        /**
         * 把所有数据放到一个map中去,key为行号加列号
         * 
         * @return
         */
        public HashMap<String, String> getExcelDate()
        {
            mapData = new HashMap<String, String>();
            for (int i = 0; i < this.totalRows; i++)
            {
                for (int j = 0; j < this.totalCells; j++)
                {
                    this.mapData.put(i + "" + j, this.getData(j, i));
                }
            }
            return this.mapData;
        }
        
        /**
         * 得到总行数
         */
        private void getRows()
        {
            this.totalRows = sheet.getRows();
        }
        
        /**
         * 得到总列数
         */
        private void getCells()
        {
            this.totalCells = this.sheet.getColumns();
        }
        
        /**
         * 得到数据
         * 
         * @param cell
         * @param row
         * @return
         */
        private String getData(int cell, int row)
        {
            Cell rs = this.sheet.getCell(cell, row);
            return rs.getContents();
        }
    }给你找的个例子