Andrew Kretzer (Leftbower) did a great job of porting the Team CFAdvance cfspreadsheet-railo extension over to work with Lucee. Since we have multiple sites (contexts) running on our servers, I needed his cfspreadsheet-lucee extension to install at the server context instead of individually for each site. The default intall of cfspreadsheet-lucee installs only on the web context. After much struggling, here is what finally got it working on the server context.
- Download the cfspreadsheet-lucee extension from GitHub. Get the full zip file.
- Follow his instructions for setting up your own custom extension provider (in README.md). You can test this if you want by adding it to Providers in your Lucee admin, but don't install cfspreadsheet yet.
- In your new extension provider folder (http://your_local_site_host/luceeExtensionProvider), you will need to change several files.
- Edit ExtensionProvider.cfc and change the line QuerySetCell(apps,'type','web'); to QuerySetCell(apps,'type','server');
- Unzip the cfpoi.zip file.
- Edit installFolder.cfc. Replace all instances of the string "lucee-web-directory" with "lucee-server-directory".
- Unzip the nested cfpoi.zip (yes, there is a cfpoi.zip inside cfpoi.zip).
- Within that folder, edit spreadsheet/spreadsheet.cfc. Again, replace all instances of the string "lucee-web-directory" with "lucee-server-directory".
- Now, you need to zip cfpoi.zip all back up in the exact structure it had previously. You'll end up with cfpoi.zip inside a cfpoi.zip, like it was before. Be careful to only zip the contents of the directories into these files. I messed this up multiple times – I kept zipping the cfpoi folder instead of its contents, and I ended up with zip files that contained one folder called cfpoi. That won't work.
- Replace the existing cfpoi.zip in /luceeExtensionProvider with your newly edited and zipped file.
- On your Lucee server, you will need to create the following directory if it does not exist already: {lucee_install_dir}\lib\lucee-server\context\components
- Now, add your custom extension provider to your server admin (if you haven't already).
- Click on Applications in the server admin, and you should now see CFSPREADSHEET and can install it.
- UPDATE: Based on feedback below, I added this step. It may not be necessary in all configurations.
In the server administrator, go to Archives & Resources > Component. Create a New Additional Resource…
Name: Server Components
Resource: {lucee-server}/components/
(other options default)
After this, all of your sites (contexts) will have cfspreadsheet available!
An alternative way of getting spreadsheet functionality in Lucee is through my spreadsheet library:
https://github.com/cfsimplicity/lucee-spreadsheet
Existing code needs adapting but there’s no installation required and you get the benefit of more up-to-date POI jars, no dependencies on Lucee jars, and some additional functionality not found in Lucee or ColdFusion.
v 4.00 getting an error:
java.lang.StackOverflowError
error occured in zip://C:\lucee\lib\lucee-server\context\extensions\4C901E6B63FD9B49107D97B6E2C67D33\4.00.rep!/InstallFolder.cfc:77
called by zip://C:\lucee\lib\lucee-server\context\extensions\4C901E6B63FD9B49107D97B6E2C67D33\4.00.rep!/Install.cfc:26
called by zip://C:\lucee\lib\lucee-server\context\extensions\4C901E6B63FD9B49107D97B6E2C67D33\4.00.rep!/Install.cfc:41
Thoughts?
Got this fixed… had a corrupted archive and had to manually uninstall ALL of the archive pieces by hand (including files in \lucee\lib\lucee-server\context\components AND \lucee\lib\lucee-server\context\extensions).
For the record: “your_local_site_host” mentioned is in \lucee\tomcat\webapps\ROOT for the location to create the ‘luceeExtensionProvider’ directory and is accessed by http://127.0.0.1:8888/luceeExtensionProvider/
Thanks!
@Randy – Glad it worked out for you. When you say that you had a corrupted archive, do you mean that the one on Github is corrupted when you download it? It seems like it is valid to me, but wanted to check.
I followed the steps precisely, but when try to make a call to cfspreadsheet in a test page, i get this:
Invalid component definition, can’t find component [org.cfpoi.spreadsheet.Spreadsheet]
The Error Occurred in
C:\lucee\lib\lucee-server\context\library\tag\spreadsheet.cfc: line 145
143:
144:
145:
146:
147:
called from C:\inetpub\wwwroot\sandbox\spreadsheet.cfm: line 15
Any thoughts?
I had a similar issue when I was setting this up. It turned out that I had zipped the files one level too deep. Check this path on your server…
C:\lucee\lib\lucee-server\context\components\org
I had two nested cfpoi folders in there. It should be org > cfpoi > spreadsheet.
If you don’t have access at the server level, then check your cfpoi.zip file to make sure only the contents of the cfpoi folder are zipped, and not the folder itself.
Michael-
I actually did check that and do indeed have the path just like that.
I solved it by doing this:
in server admin archive & resources -> Component , I added an additional Resource:
name = “server comps”, resource = {lucee-server}/components/
after noticing that I only had
name =”default”, resource= {lucee-web}/components/
Then it worked..
are you saying I should not have had to do that?
@Scott – that is odd. I did not have to do that on any of the sites I use this on. Maybe a slightly different Lucee version, or even some configuration change that was made that removed a mapping? Well, hopefully if others run into it they will see your post and have a solution.
Michael – I had the same issue as Scott. I added the Component directory in the Lucee server admin just as he did and the code worked and exported the XLS file as expected.
I had just upgraded Lucee to the latest stable version (Lucee 4.5.2.018 final at time of this writing) FWIW.
Thanks Dan and Scott. I added a final step to the instructions to save others the trouble.
I am trying to install this. I am running Lucee with IIS so the root of the applicaiton is in c:\inetpub\htdocs\ and not in c:\lucee\etc… I get the page with the Install button and cancel. When I click install I get these errors:
Things go well right up to the point of installing this in Web Admin -> Extension -> Applicaitons. When I click the install icon for
missing config file in extension package
error occured in /context/admin/extension.applications.install2.cfm:66
called by /context/admin/extension.applications.cfm:98
called by /context/admin/web.cfm:389
file or directory zip://C:/lucee/tomcat/webapps/ROOT/WEB-INF/lucee/extensions/4C901E6B63FD9B49107D97B6E2C67D33/4.00.rep!/config.xml not exist
error occured in /context/admin/extension.applications.install2.cfm:110
called by /context/admin/extension.applications.cfm:98
called by /context/admin/web.cfm:389
Any advice on how to handle installing to a path that is not the default Lucee installation directory?
As a followup to my previous question. I was able to make this work.
The key was to pay very close attention to where you are making these changes. Lucee has a Server and Web administrator and the goal of this post it so work in the Server and not the Web administrator.
Secondly, unzipping, editing, and re-zipping the files is tricky. If you use Windows, the behavior of Windows is to zip extra folders into and out of zip files. This is a pain.
luceeExtensionProvider/cfpoi.zip/cfpoi.zip/spreadsheet/Spreadsheet.cfc is the path to the deepest cfc you will edit.
You can place the luceeExtensionProvier into a path other than the lucee root context directory. (like c:\inetpub\htdocs\sitename) just make sure that the URL you put into the Server -> Extension -> Providers area is accessible such as http://www.mysitename.com/luceeExtensionProvider/ExtensionProvider.cfc
Thanks Tim. I was planning to get back to you today, but you solved this quicker than I would have.