Copy link to clipboard
Copied
Hello,
I have recently updated coldfusion from 2016 to 2021, before update I used following code to write an excel file with cells containig dropdown list
<!--- Create an instance of a new spreadsheet --->
<cfset spreadsheet = spreadsheetNew("My Spreadsheet", true)>
<!--- we need all this so we can have dropdowns --->
<cfset workbook = spreadsheet.getWorkBook()>
<cfset worksheet = workbook.getSheet("My Spreadsheet")>
<cfset dataValidationConstraint = createObject("java","org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint")>
<cfset cellRangeList = createObject("java","org.apache.poi.ss.util.CellRangeAddressList")>
<cfset dataValidationHelper = createObject("java","org.apache.poi.xssf.usermodel.XSSFDataValidationHelper").init(worksheet)>
<!--- Define cell list rowstart, rowend, column start, column end --->
<cfset list = cellRangeList.init(0, 0, 0, 0)>
<cfset dvconstraint = dataValidationHelper.createExplicitListConstraint(["YES","NO"])>
<cfset dataValidation = dataValidationHelper.createValidation(dvconstraint, list)>
<cfset dataValidation.setSuppressDropDownArrow(true)>
<!--- add it to the spreadsheet --->
<cfset worksheet.addValidationData(dataValidation)>
<!---write file--->
<cfspreadsheet action="write" name="spreadsheet" filename="test.xlsx" format="csv" overwrite="true">
On CF 2016 this script worked fine, now on 2021 version I have the following error:
Unable to find a constructor for class org.apache.poi.xssf.usermodel.XSSFDataValidationHelper that accepts parameters of type ( org.apache.poi.xssf.usermodel.XSSFSheet )
My 2021 installation is:
- Version: 2021.0.04.330004
- JVM: jdk-11.0.16
Has someone any suggestions to let work the same script also on 2021 version?
Thanks
Copy link to clipboard
Copied
Yes, that is likely to be a bug. Please report it in Adobe Tracker..
As you can see from XSSFDataValidationHelper's API, it definitely has a constructor of type org.apache.poi.xssf.usermodel.XSSFSheet. Please mention this in your bug ticket.
@RiccardoArea wrote:
Has someone any suggestions to let work the same script also on 2021 version?
In my opnion, the only recourse is for Adobe's ColdFusion Team to urgently fix it. I say this because it is a fundamental problem.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks. I have added a comment to the ticket and voted to have it fixed.