Spreadsheet comments in xmlformat cause exception
Copy link to clipboard
Copied
I've ran into a strange issue while working with comments in excel spreadsheets. When not using xmlformat (.xls) comments work fine, but if I start using xmlformat (.xlsx) I start getting "Multiple cell comments in one cell are not allowed". I'm running ColdFusion 2016
I'm including a snippet of code below that will work fine for .xls style documents but error out for .xlsx style documents.
<cfscript>
// Runs without error
mydoc = spreadsheetNew("Test", false);
setComments(mydoc);
spreadsheetwrite(mydoc, "#expandPath("./")#test.xls",true);
writeoutput('<a href="./test.xls">Download good</a><br>');
//Throws java.lang.IllegalArgumentException: Multiple cell comments in one cell are not allowed, cell: E9
mydoc2 = spreadsheetNew("Test", true);
setComments(mydoc2);
spreadsheetwrite(mydoc2, "#expandPath("./")#test.xls",true);
writeoutput('<a href="./test2.xlsx">Download bad</a>');
//write some data and comments to the spreadsheet
function setComments(doc){
for(row = 1; row <= 50; row += 1){
for(col = 1; col <= 50; col += 1){
spreadsheetSetCellValue(doc, "row: #row#, col: #col#", row, col);
SpreadsheetSetCellComment(doc,{comment:"(#row#,#col#)"},row, col);
}
}
}
</cfscript>
Is there some difference in using .xlsx that I don't know about, or is this a bug within ColdFusion?
Thanks,
Chris
Copy link to clipboard
Copied
Hi christophere99273954​,
I think it is a bug. I have been able to confirm it on ColdFusion 2018 and have reported the ColdFusion bug, POI XSSF cell comment error.

