Leftbower / cfspreadsheet-lucee-5

A cfspreadsheet extension for Lucee 5
23 stars 10 forks source link

Lucee 6 - SpreadsheetAddRows() Error #30

Open spraguey opened 1 month ago

spraguey commented 1 month ago

I'm getting the following error when I run SpreadsheetAddRows().

Message: 'double lucee.runtime.functions.math.Min.call(lucee.runtime.PageContext, double, double)' Type: java.lang.NoSuchMethodError Tag Context:| /org/cfpoi/spreadsheet/Spreadsheet.cfc [2952]

I extracted and opened spreadsheet.cfc, and I see the following on line 2952: return Min( Local.width, (255*256) );

I'm not having much luck trying to find this error on Google.

spraguey commented 1 month ago

In case it helps, this is the block of code running it. This was working with Lucee 5. It errors on the 4th line.

<cfset spObj = spreadsheetNew(xmlFormat="true")> <cfset spreadsheetAddRow(spObj, arguments.fieldlabels)> <cfset spreadsheetFormatRow(spObj, {bold="true"}, 1)> <cfset spreadsheetAddRows(spObj, arguments.query,2,1)>

spraguey commented 1 month ago

I was able to write some simple replacement code to get around this, but I can't figure out how to deploy it. Can anyone help? @Leftbower ?

I extracted spreadsheet.cfc from cfc-archive-cfspreadsheet.lar. I make the following change to replace the Min function call.

if (Local.width LTE (255*256)) {
    return Local.width;
} else {
    return (255*256);
}

I then re-compress cfc-archive-cfspreadsheet.lar with the changed file and restart Lucee.

I still get the exact same error on the same line number, and the debugging shows the same old Min() line that I replaced. Could it be something to do with the spreadsheet_cfc$cf.class in the archive? Or does cfspreadsheet.cfc also exist in another place besides the LAR file?

Leftbower commented 1 month ago

Yes, Lucee is picking up the original, compiled class file which doesn't have your changes. You need to replace that with the newlsy compiled class file that includes your updates.

spraguey commented 1 month ago

I guess that is the piece of the puzzle I am missing. I don’t know how to generate the class file.

Leftbower commented 1 month ago

You can do it from within the Lucee admin. Navigate to the Component section under Archives & Resources. There are a number of tools/settings in there (my apologies... it's been a long time since I've looked at this).

spraguey commented 1 month ago

If anyone else runs into this issue, here is a fixed LAR file you can use. cfc-archive-cfspreadsheet.lar.zip