Skip to main content
christophere99273954
Participant
September 28, 2018
Question

Spreadsheet comments in xmlformat cause exception

  • September 28, 2018
  • 1 reply
  • 280 views

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

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
September 29, 2018

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.