java - JXLS - how to create hyperlink to Excel worksheets in workbook -
i trying create excel workbook with jxls. want text hyperlink navigating through worksheets in workbook. couldn't find helpful information online. please give idea or hyperlink can to solve problem. thanks
jxls small , easy-to-use java library writing excel files using xls templates , reading data excel java objects using xml configuration. if trying create hyerlink, jxls doen't have low lever excel manupulation capability. can use apache poi free library. code create hyperlink cell task shown below.
//creating cell row row = my_sheet.createrow(0); cell cell = row.createcell(0); //creating helper class xssfworkbook workbook = new xssfworkbook(); xssfcreationhelper helper= workbook.getcreationhelper(); //creating hyperlink link = helper.createhyperlink(hssfhyperlink.link_document); link.setaddress("'target_worksheet_name'!a1"); //optional hyperlink style xssfcellstyle hlinkstyle = workbook.createcellstyle(); xssffont hlinkfont = workbook.createfont(); hlinkfont.setunderline(xssffont.u_single); hlinkfont.setcolor(hssfcolor.blue.index); hlinkstyle.setfont(hlinkfont); //applying hyperlink cell cell.sethyperlink(link);
Comments
Post a Comment