This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line! See this thread for details.
I can't correctly insert the Chinese Encoding String into Cell. When it's opened by Excel, the words in Chinese are not correct. The code is following: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("new sheet"); // Create a row and put some cells in it. Rows are 0 based. HSSFRow row = sheet.createRow((short)0); // Create a cell and put a value in it. HSSFCell cell = row.createCell((short)0); cell.setCellValue(1); // Or do it on one line. row.createCell((short)1).setCellValue(1.2); //row.createCell((short)2).setCellValue("测试"); row.createCell((short)2).setCellValue(new String("测试".getBytes("ISO8859-1"), "GBK"))); row.createCell((short)3).setCellValue(true); // Write the output to a file FileOutputStream fileOut = new FileOutputStream("workbook.xls"); wb.write(fileOut); fileOut.close(); :roll:
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad: