Apache POI And HyperLinks

I recently came across a requirement where i had to add hyperlink in excel Generated By Apache POI in Java. I have gone through the API and Found out that there is no API which Supports this and there is also no cell type which define something like this HSSFCell.CELL_TYPE_HYPERLINK.  I tried a lot and Finally Found a hack for this. To our rescue came the Office which has a function called HYPERLINK. I made my life easy and Immediately i had set Formula for that Column.

Here is the snippet for adding HyperLink

cell.setCellFormula(“HYPERLINK(\”” + linkValue+ “\”,\”” + actualValue + “\”)”);

Here LinkValue refers Hyperlink and actualValue refers to the value which is to be hyperlinked.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s