Ignite UI – (jQuery) – 无法使用ig.excel.WorksheetCellComment在单元格中添加注释

我正在试图在工作表中的单元格中添加注释。 该function没有错误的工作,但在Excel中,它添加了一个空白的评论部分没有文字。 请帮忙。

$("#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

 .... var comment = new $.ig.excel.WorksheetCellComment(); var formatted = new $.ig.excel.FormattedString("This is a comment"); // The $.ig.excel.WorksheetCellComment does not have .Text as a property // See http://www.igniteui.com/help/api/2016.1/ig.excel.WorksheetCellComment#methods:text comment.text(formatted); 

评论是存在于Excel文件。

http://www.igniteui.com/help/api/2016.1/ig.excel.WorksheetCellComment#methods:text