2
在單元格中添加註釋我正在嘗試將註釋添加到工作表中的單元格中。該功能沒有錯誤,但在Excel中,它添加了一個沒有文字的空白註釋部分。請幫忙。Ignite UI - (jQuery) - 無法使用ig.excel.WorksheetCellComment
$("#input").on("change", function() {
var excelFile,
fileReader = new FileReader();
$("#result").hide();
fileReader.onload = function (e) {
var buffer = new Uint8Array(fileReader.result);
$.ig.excel.Workbook.load(buffer, function (workbook) {
var column, row, newRow, cellValue, columnIndex, i,
worksheet = workbook.worksheets(0),
columnsNumber = 0,
gridColumns = [],
data = [],
worksheetRowsCount;
var comment = new $.ig.excel.WorksheetCellComment();
var formatted = new $.ig.excel.FormattedString("This is a comment");
comment.Text = formatted;
worksheet.rows(2).cells(4).comment(comment);
saveWorkbook(workbook, "Formatting.xlsx");
}, function (error) {
$("#result").text("The excel file is corrupted.");
$("#result").show(1000);
});
}
if (this.files.length > 0) {
excelFile = this.files[0];
if (excelFile.type === "application/vnd.ms-excel" || excelFile.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || (excelFile.type === "" && (excelFile.name.endsWith("xls") || excelFile.name.endsWith("xlsx")))) {
fileReader.readAsArrayBuffer(excelFile);
} else {
$("#result").text("The format of the file you have selected is not supported. Please select a valid Excel file ('.xls, *.xlsx').");
$("#result").show(1000);
}
function saveWorkbook(workbook, name) {
workbook.save({ type: 'blob' }, function (data) {
saveAs(data, name);
}, function (error) {
alert('Error exporting: : ' + error);
});
}
}
});
,嘗試了這個鏈接http://www.igniteui.com/help/api/2016.1/ig.excel.WorksheetCellComment
我只看到一個空白的評論泡泡,文字沒有被插入。任何人都可以提出any.alternatives ... – bkr