Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JSpreadsheet
>
Tutorial
> Create Hyperlink
The following example shows you how to create a hyperlink.
import com.independentsoft.office.spreadsheet.Cell; import com.independentsoft.office.spreadsheet.DataBarColor; import com.independentsoft.office.spreadsheet.Font; import com.independentsoft.office.spreadsheet.Hyperlink; import com.independentsoft.office.spreadsheet.Underline; import com.independentsoft.office.spreadsheet.UnderlineType; import com.independentsoft.office.spreadsheet.Workbook; import com.independentsoft.office.spreadsheet.Worksheet; import com.independentsoft.office.spreadsheet.styles.CellFormat; public class Example { public static void main(String[] args) { try { DataBarColor dataBarColor = new DataBarColor(); dataBarColor.setColor("0000FF"); Font font1 = new Font(); font1.setName("Calibri"); font1.setSize(11); font1.setFamily(2); font1.setUnderline(new Underline(UnderlineType.SINGLE)); font1.setColor(dataBarColor); CellFormat format1 = new CellFormat(); format1.setFont(font1); Cell a1 = new Cell("Independentsoft"); a1.setHyperlink(new Hyperlink("http://www.independentsoft.com")); a1.setFormat(format1); Worksheet sheet1 = new Worksheet(); sheet1.set("A1", a1); Workbook book = new Workbook(); book.getSheets().add(sheet1); book.save("c:\\test\\output.xlsx", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*