1.當要增加註解在Excel Cell 中,透過WritableCellFeatures Class的setComment(String)加入註解
WriteExcelWithComment.java |
package tw.com.haoxiao.excel.write; import java.io.File; import jxl.Workbook; import jxl.write.Label; import jxl.write.WritableCellFeatures; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; public class WriteExcelWithComment { private static String excelURL = "C:/ExcelWithComment.xls"; public static void main(String[] args)throws Exception { // 建立Excel File File excelFile = new File(excelURL); WritableWorkbook writeable = Workbook.createWorkbook(excelFile); // 建立Excel Content WritableSheet sheet = writeable.createSheet("Commnet", 0); Label label = new Label(1,1,"Write Comment"); // 產生註解 WritableCellFeatures cellFeatures = new WritableCellFeatures(); cellFeatures.setComment("增加一個註解"); // 將註解加入至Label label.setCellFeatures(cellFeatures); // add Cell sheet.addCell(label); // Output and Close writeable.write(); writeable.close(); } } |
0 意見:
張貼留言