sheet.setColumnWidth(i, (int)(title.getBytes().length * 1.2d * 256 > 12 * 256 ? title.getBytes().length * 1.2d * 256 : 12 * 256));
//256為單個字符所占的寬度
//1.2d表示比實際寬度大20%
//12*256表示最低寬度為12個字符
sheet.setColumnWidth(i, (int)(title.getBytes().length * 1.2d * 256 > 12 * 256 ? title.getBytes().length * 1.2d * 256 : 12 * 256));
//256為單個字符所占的寬度
//1.2d表示比實際寬度大20%
//12*256表示最低寬度為12個字符
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。