Coldfusion open excel file




















Active 7 years, 3 months ago. Viewed 3k times. I have following ColdFusion code to open the file with Excel format. QueryName - Request. Improve this question. Leigh Add a comment. Active Oldest Votes. You need to set the content type as vnd. Improve this answer. Anit Kumar Anit Kumar 1, 8 8 silver badges 14 14 bronze badges.

I'll try here too! I am actually using the JavaProxy as he has demoed. I am not sure if it is getting confused between the one I am calling and the one that is in the Java class paths. Ben, this is probably the best article on CF-Excel creation on the web. I was trying to figure out how to generate comments on field column headers those little yellow notepads that pop up.

Using your suggestion of exporting an excel sheet for the web revealed the proper code. A simple idea that hadn't crossed my mind. Thanks for the comments.

I am glad you like the solution. And thanks for posting the tip for others to see. Have you ever heard of someone being able to open the resulting file up in Excel on one computer but not on another. I believe we are using the Nate Weiss tab-delimited output method and it opens fine on one compyter but then when the information is opened on a laptop running the same version of Excel it all goes into just the first column, any ideas?

That is strange indeed. I have not had a ton of experience with this, so I cannot say for sure. Are the operating systems different for the two dif computers?

Everything is basically the same one is a desktop computer the other that is having the problem is a laptop. Doug, that is too strange. The only think I can suggest is to create an actual Excel document using Excel.

Other than that, I am out of ideas. I have not tried to do this with an IMG. You might want to try looking into a Java-based solution like POI to deal with embedded image data. Sorry I could not be of more help.

I've had a similar problem to Doug - i can open the file on one computer and not on another - same excel version, same files, etc. Just an FYI, but very much interested in solutions Thanks for the example 2. I am wondering if you have been able to achieve the same results exporting data either from a cfgrid or directly from a database.

Also, the tab-delimited option posted by Bruce seems interesting but I do not have that book handy and have not been able to find any sample code. Have you given that method a try? Works quite nicely. I should preface all of my posts with the fact that I am an utter newbie when it comes to CFML or programming for the matter.

This was amazingly handy. Like you mentioned in your post above I often need to give people the option to download datasets as. Unfortunately with the latest IE browsers, I'm now getting a message that the 'file is in a different format to the extension, and that it may be corrupted. Do you still want to open it etc Has anyone found a work around for that?

I'm going to have to go back to the csv output at present. James, I know this is outdated, but the search engines seem to keep picking it up so hence the update:. James, is getting the error because MS Office is now looking for actual excel documents.

The attribute helps when you read Excel as a query. When you specify the headerrow attribute, the column names are retrieved from the header row. But they are also included in the first row of the query. To not include the header row, set true as the attribute value. Column number or range of columns. Specify a single number, a hypen-separated column range, a comma-separated list, or any combination of these; for example: 1,,9. Note: Setting a range higher than the actual number of columns in sheet results in an exception when accessing columns which are yet to be added.

Set a password for modifying the sheet. Note: Setting a password of the empty string does no unset password protection entirely; you are still prompted for a password if you try to modify the sheet. The range of rows to read. Specify a single number, a hypen-separated row range, a comma-separated list, or any combination of these; for example: 1,,9.

Name of the sheet For the read action, you can specify sheet or sheetname. For write and update actions, the specified sheet is renamed according to the value you specify for sheetname. The following example uses the cfspreadsheet tag to read and write Excel spreadsheets using various formats. It also shows a simple use of ColdFusion Spreadsheet functions to modify a sheet. Let's take chunks of the above code and see each chunk in action. For example, consider a csv file is uploaded on the web, which you want to retrieve and perform some actions.

You can also jump to ths fiddle and try out the code chunks. Sign in with your Google or Facebook credentials and launch the file cfspreadsheet.



0コメント

  • 1000 / 1000