Hello
I am trying to add a comment into a cell in an existing excel . The functionality works without error but I see only a blank comment . Please help.
$("#input").on("change", function () {
var excelFile,
fileReader = new FileReader();
$("#result").hide();
fileReader.onload = function (e) {
extendedVm.gettingDataimageSave(true);
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 workbook = new $.ig.excel.Workbook($.ig.excel.WorkbookFormat.excel2007);
//workbook.worksheets().add(worksheet);
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");
// we can also skip passing the gridColumns use autoGenerateColumns = true, or modify the gridColumns array
//createGrid(data, gridColumns);
}, function (error) {
//Need to be changed
$("#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').");
function saveWorkbook(workbook, name) {
workbook.save({ type: 'blob' }, function (data) {
saveAs(data, name);
alert('Error exporting: : ' + error);
})
Expecting a Response guys ... Please suggest me a work around .
Hi Balakumar Ezhilmaran,
It seems that our system missed that post and it was out of our sight. Please, accept our apologies for that misunderstanding. I suggest you to continue our communication in the new created forum post: Add cell comment using WorksheetRow.