How To Use Hyperlinks on Excel Sheet Using JExcel APIs.
Previous | Home | Next |
In this tutorial we will learn how to use Hyperlinks on Excel Sheet Using JExcel APIs.
To create a hyperlink in the excel worksheet you have to import jxl.write.WritableHyperlink class. To create a new URL you also have to import java.net.URL class. There are several constructors avaiable for creating different types of hyperlinks viz.
WritableHyperlink(Hyperlink hlk, WritableSheet wksht)
It is the constructor used internally by the worksheet whie making the copy of worksheet
WritableHyperlink(int col, int row, File file)
It is the constructor which creates a file hyperlink in a single cell.
WritableHyperlink(int col, int row, File file, String description)
This constructor also constructs a file hyperlink in a single cell but giving a descriptive name.
WritableHyperlink(int col, int row, int lstcol, int lstrow, File file)
It constructs a File hyperlink to a range of cells.
WritableHyperlink(int col, int row, int lstcol, int lstrow, File file, String description)
This constructor constructs a File hyperlink to a range of cells by giving a descriptive name to it.
WritableHyperlink(int col, int row, int lstcol, int lstrow, String description, WritableSheet wksht, int descol, int desrow, int lstdescol, int lstdesrow)
This constructor constructs a hyperlink to some cells within the current workbook
WritableHyperlink(int col, int row, int lsstcol, int lsstrow, URL url)
It constructs a url hyperlink to a range of cells
WritableHyperlink(int col, int row, int lstcol, int latrow, URL url, String description)
It constructs a url hyperlink to a range of cells with having description on it.
WritableHyperlink(int col, int row, String desc, WritableSheet wksht, int descol, int desrow)
This constructor constructs a hyperlink to some cells within the current workbook
WritableHyperlink(int col, int row, URL url)
It creates a URL hyperlink in a single cell
The following code snippet will show you how to insert an hyperlink in your current worksheet,
WritableHyperlink whl=new WritableHyperlink(6, 1, new URL("http://www.r4r.co.in"));
sheet.addHyperlink(whl);
In the above lines of the code we have created an hyperlink object, and in the constructor of the WritableHyperlink we have passed the column and row values along with the URL value, and then finally we have added the object to the sheet.
Previous | Home | Next |