首页 > 解决方案 > Under the IDEA environment of Windows 10, it is garbled when using jxl to read in the excel table and output Chinese

问题描述

import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import java.io.*;
public class Myworkbook  {
    Workbook mybook ;
    Sheet studentsheet;
    Sheet schoolsheet;
    public Myworkbook(String path) {
        try {
            mybook=Workbook.getWorkbook(new FileInputStream(path));
            studentsheet=mybook.getSheet(0);
            schoolsheet=mybook.getSheet(1);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (BiffException e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        Myworkbook mybook=new Myworkbook("C:\\Users\\Die-for-myself\\Desktop\\xiaoshengchu.xls");
        System.out.println(mybook.schoolsheet.getName()+mybook.studentsheet.getCell(1,1).getContents());
    }
}
  1. Print result

  2. Excel Value

  3. Excel Attributes

The saving encoding is GB2312, which is using for Chinese.

标签: javaexceljava-iojxl

解决方案


推荐阅读