Highlighted

creating .xslx files in coldfusion 8

Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

Hello All

I am on a CF8 server (the company hasn't upgraded) an I need to create an xslx file.

Any suggestions?

Views

659

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

creating .xslx files in coldfusion 8

Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

Hello All

I am on a CF8 server (the company hasn't upgraded) an I need to create an xslx file.

Any suggestions?

Views

660

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 08, 2016 0
LEGEND ,
Feb 08, 2016

Copy link to clipboard

Copied

I don't know of a solid way to do that in CF8.  If you were on at least CF9, there is CFSPREADSHEET (for tag-based code) or SPREADSHEETNEW() (for CFSCRIPT code.)  I prefer the latter, as it gives much more granular control.

HTH,

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Most Valuable Participant ,
Feb 08, 2016

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

Thanks

I am actually looking at that now.

I’ve downloaded the code and changed the ext to .xslx and it creates a file but it won’t open.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Engaged ,
Feb 08, 2016

Copy link to clipboard

Copied

The best way I've found to export data from ColdFusion 4, 5, 6, 7, 8, 9, 10 & 11 to XLSX format is to use CFExecute and Total CSV Converter

https://www.coolutils.com/TotalCSVConverter

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

Thanks!

Will give it a try.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Engaged ,
Feb 08, 2016

Copy link to clipboard

Copied

I'm not sure if this will work on CF8, but here's a UDF I optimized to generate better CSV so that dates, strings, non-numeric-string and other values are preserved when converting to Excel.  Use this w/Total CSV Converter... or just return the CSV file and it will open nicely in current versions of Excel.

https://gist.github.com/JamoCA/b2d0467dd914909f00bf

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Engaged ,
Feb 08, 2016

Copy link to clipboard

Copied

Here's some sample code regarding how to convert a CSV file to XLSX:
https://gist.github.com/JamoCA/75399b2eee3ad792a2e7

I was using ColdFusion 9 (and tested this using CF10) on a client's data export that was taking ~10 minutes to perform.  If I used Ben Nadel's POI library, it wouldn't take as along... but only because it was hitting Java HEAP RAM limitation faster and throwing an error.  Once I switched to Total CSV Converter, the conversion process only took ~10 seconds.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

Thank you

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

Jamo, do you have a full code sample of this?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Jamo LATEST
Engaged ,
Feb 08, 2016

Copy link to clipboard

Copied

Full sample?  The only thing that is critical is the command-line syntax for use w/Total CSV Converter.  All you need to do is pass the full path & filename of the existing CSV and Excel file to create.

<cfexecute name="C:\TotalCSVConverter\CSVConverter.exe" arguments="""#InFile#"" ""#OutFile#"" -kfs -c XLSX -comma ##44 -quote ##34 -fh -TM 0.5 -LM 0.5 -BM 0.5 -RM 0.5 -ps A4" variable="Response" timeout="60"></cfexecute>

In addition, you can use this program to convert to JSON, XML, PDF, HTML, Word Doc, DBF, etc... It appears to be portable and can be installed anywhere on a Windows server.  There's a helpful onboard wizard that assists with locating files and setting up new jobs through an easy to use GUI.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0