看看這篇合不合用
感謝回答,不過這篇看起來也只有提到備註,沒有註解功能
那就試試jexcelapi
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.*;
import jxl.write.biff.RowsExceededException;
// Load the Excel file
Workbook workbook = Workbook.getWorkbook(new File("path/to/your/file.xls"));
// Get the desired sheet
Sheet sheet = workbook.getSheet(0);
// Get the cell and its note
Cell cell = sheet.getCell(colNum, rowNum);
String note = cell.getNote();
if (note != null) {
System.out.println("Cell note: " + note);
}
// Close the workbook
workbook.close();
// Load the Excel file
Workbook workbook = Workbook.getWorkbook(new File("path/to/your/file.xls"));
WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File("path/to/your/updated/file.xls"), workbook);
// Get the desired sheet
WritableSheet sheet = writableWorkbook.getSheet(0);
// Get the cell and create a new note
WritableCell cell = sheet.getWritableCell(colNum, rowNum);
WritableCellFeatures cellFeatures = new WritableCellFeatures();
cellFeatures.setComment("This is a note.");
cell.setCellFeatures(cellFeatures);
// Save the changes to the Excel file
writableWorkbook.write();
writableWorkbook.close();
// Close the workbook
workbook.close();
這程式一看就知道不是我寫的
是問ChatGPT寫的
好的,我試試
ChatGPT真是萬能XD
分享不同程序知識的優質文章。每種語言經過多次接觸後都會給人留下深刻的印象。讓我們一起深入學習,提陞技能 coreball
Apache POI 是一个强大的 Java 库,用于读写 Microsoft Office 格式的文件,包括 Excel。虽然 POI 库本身提供了许多功能,但其对 Excel 文件中的注释支持比较有限 Friday Night Funkin