Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:51:52+00:00 2026-06-02T05:51:52+00:00

Using Coldfusion 8 has anyone been able to either embed images into a excel

  • 0

Using Coldfusion 8 has anyone been able to either embed images into a excel spreadsheet (xlsx) or link them via img src?

Some background info: The cf server will pickup an excel document with product rows. Based on the product id and style etc, I be able to find or create an image that gets added as the first column into the existing excel doc.

I know coldfusion 9 has a function called SpreadsheetAddImage, unfortunately I’m on cf 8 with no chance to upgrade.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:51:53+00:00Added an answer on June 2, 2026 at 5:51 am

    I am not sure what you are currently using to manipulate the xlsx files. However, the spreadsheet functionality in CF9 utilizes POI, which can obviously be used from CF8 as well. It just requires a little more low level code.

    Pre-requisites:

    Though POI is bundled with CF8, it is an old version. You need a newer version to manipulate .xlsx files. You can either use the javaLoader -OR- replace the existing jars in {cf_root}\lib folder. Note, I do not know if replacing the jars has any negative side effects.

    Adding Images:

    Excel does not really support <img> tags, only hyperlinks. However, you can embed images within the workbook like SpreadsheetAddImage does. As outlined in the POI’s Busy Developers Guide, the basic process is:

    1. Load the xlsx file with the WorkBookFactory
    2. Grab the binary of each image and add it to the workbook
    3. Anchor each image to the desired cells
    4. Save the modified workbook to back to disk

    Example:


    <cfscript>
        // .. 
    
        // load the xlsx file with the javaLoader
        factory = loader.create("org.apache.poi.ss.usermodel.WorkbookFactory");
        input = loader.create("java.io.FileInputStream").init( "c:/path/to/someFile.xlsx" );
        workbook = factory.create( input );
        input.close();
    
        // get the desired sheet and load helper objects (once)
        sheet     = workbook.getSheet("Your Sheet Name");
        patriarch = sheet.createDrawingPatriarch();
        helper    = workbook.getCreationHelper();
    
        // add the image to the workbook
        imageBytes  = fileReadBinary( "c:/path/to/someImage.jpg" );
        imageIndex  = workbook.addPicture( imageBytes, workbook.PICTURE_TYPE_JPEG );
    
        // anchor the picture to the first cell ie A1
        anchor     = helper.createClientAnchor();
        anchor.setRow1( javacast("int", 0) ); // row of first cell (zero based)
        anchor.setCol1( javacast("int", 0) ); // column of first cell (zero based)
        picture = patriarch.createPicture( anchor, imageIndex );
        picture.resize(); // only supported for jpg and png
    
        // save it back to disk
        outstream = loader.create("java.io.FileOutputStream").init( "c:/path/to/outFile.xlsx"" );
        workbook.write( outstream );
        outstream.flush();
        outstream.close(); 
    </cfscript>
    

    New Columns
    Ironically, inserting a new column is trickier than adding an image. Last I checked, POI still lacked a built in function for inserting new columns. So you would need to shift all existing cells to the right before inserting the images into the first column. The tricky part is maintaining cell formats, merged cells, etcetera.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ColdFusion and Microsoft SQL we are exporting data to an Excel Spreadsheet using
I am using Martin Orth's ColdFusion API for Google Adwords. I have been able
Has anyone had any luck using ColdFusion as a way to collect data via
I am using ColdFusion 9.0.1. I am trying to test whether a user has
Very simple question: is there anyone who has a link to official information on
One my client has his website developed using coldfusion... Now I want to migrate
I am using ColdFusion 9. I am including a UDF library (UDF_Library.cfm) that has
Has anyone gotten the Open Source QR Code Library to work with ColdFusion? I
We are using ColdFusion MX7. The CFDOCUMENT tag uses iText for the PDF creation
I'm using coldfusion 9 and I'm trying to grab a file from an ftp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.