6 Replies Latest reply on Apr 25, 2011 6:29 AM by Reed Powell

    Insert JPG into Excel

    EndoplasmicReticulum

      I'm using MX7 and I create a JPG file using cfchart but I need to insert that JPG into excel with ColdFusion - how do I do it?

       

      Cfchart is working and I'm saving the file to a location without a problem but can't figure out how to insert it into excel.

        • 1. Re: Insert JPG into Excel
          Owain North Level 4

          MX7 doesn't have any direct support for Excel documents, you'd have to check the documentation for the Excel COM objects and see if there's any way of doing it through there.

           

          If there is, you can use createObject("com") and try to interact that way, might be a bit painful mind.

           

          O.

          • 2. Re: Insert JPG into Excel
            Adam Cameron. Level 5

            If there is, you can use createObject("com") and try to interact that way, might be a bit painful mind.

             

            You must really hate EndoplasmicReticulum to be suggesting that

             

            ;-)

             

            Nah, I only say that because I had to try to do something like this once and calling Excel via COM in a production environment... really doesn't work very well.  Excel is a desktop app, and doesn't work well being used as a server-side app.

             

            One could look to see if POI handles that sort of thing?

             

            If not, from Excel save a sample of the end result as XML, and unpick the XML to work out what one has to do to recreate such a file dynamically, and then... do that.

             

            --

            Adam

            • 3. Re: Insert JPG into Excel
              Owain North Level 4
              You must really hate EndoplasmicReticulum to be suggesting that

               

              Oh I do, saw something about a rectum endoscopy and instantly went off the guy.

               

              Incidentally, why are you trying to process data, create a chart and then import it into a data processing and charting package?

              • 4. Re: Insert JPG into Excel
                EndoplasmicReticulum Level 1

                Thanks for the help.

                 

                Well, I'm already pumping the output of a query into an excel speadsheet for my customers and now they want a bar chart of averages of the data to show below the reported data in Excel.

                • 5. Re: Insert JPG into Excel
                  Owain North Level 4

                  It sounds like perhaps a rethink is in order.

                   

                  If you wish to create them a nice report with tables and charts, use CFDOCUMENT to create them a PDF. If they want an Excel document with data they can manipulate, use Excel.

                  • 6. Re: Insert JPG into Excel
                    Reed Powell Level 3

                    There is a tag called CFX_EXCEL that you should look into.  It predates the built-in support in CF for

                    Excel interfacing, but uses the same POI library.  It supports the use of Excel tempalte files, which allows you to build a spreadsheet  or workbook in Excel, and then use the CF_EXCEL tag to put data into it.  You can build the graphs, etc., in the Excel doc to reference a specific block of cells for their data, and then populate those cells from the CF_EXCEL tag.  maybe put those cells into their own sheet.

                    -reed