poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aram Mirzadeh <...@mbcli.com>
Subject Re: Excel Hyperlink Styling with POI
Date Thu, 09 Dec 2010 17:09:51 GMT

This works for me, these are created as part of style generation, which 
are global

         // ----- Hyperlinks - by default hyperlinks are blue and underlined
         hLinkStyle = wb.createCellStyle();
         final Font hLinkFont = wb.createFont();
         hLinkFont.setColor(IndexedColors.BLUE.getIndex() );

and ..

      * Create a Hyperlink cell
      * @param origData
      * @param cell
     private static void makeHyperLink(final String linkData, final Cell 
cell, final String value) {
         final Hyperlink link = 

No idea if it's the right way of doing it .. this portion of the code is 
very old so I it maybe superseded.

On 12/9/2010 11:32 AM, story123 wrote:
> I'm working with a developer on a project to add an Excel export function to
> a website.
> For one of the cells that we're exporting, we want to turn the destination
> cell into a hyperlink that, on click, will send a User to a web site.
> e.g. Website...export values to multi-sheet excel file....on one sheet, well
> have a label that says..."click here for supplemental information"  The cell
> containing the "click here..." needs to be an active hyperlink that will
> take them to a website.  In addition, the cell itself needs to provide a
> visual cue that it is indeed a hyperlink (s/b blue and underlined)
> We're using POI and making use of the following types of commands found in
> the documentation:
> Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
> link.setAddress("http://poi.apache.org/");
> cell.setHyperlink(link);
> cell.setCellStyle(hlink_style);
> //cell style for hyperlinks
> //by default hypelrinks are blue and underlined
> CellStyle hlink_style = wb.createCellStyle();
> Font hlink_font = wb.createFont();
> hlink_font.setUnderline(Font.U_SINGLE);
> hlink_font.setColor(IndexedColors.BLUE.getIndex());
> hlink_style.setFont(hlink_font);
> To date, our results have been that we're getting a cell in the worksheet
> that is functioning as a hyperlink but we can't seem to get the hyperlink
> styling (blue underline) to manifest itself.
> In addition, I've tried setting a cell above the destination cell to be
> "=hyperlink(destcellreference)" -- and that only works if I then go to the
> cell and do F2-Enter.
> Can someone provide us some assistance / pointers on how we might be able to
> get our link styling to work ?
> (p.s. we've been exporting to Excel2003 but for grins I just tried 2007 and
> the results were the same)
> Thanks

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message