1 2 17 18 19 package org.apache.poi.hssf.usermodel.examples; 20 21 import org.apache.poi.hssf.usermodel.*; 22 23 import java.io.FileOutputStream ; 24 import java.io.IOException ; 25 26 31 public class HyperlinkFormula 32 { 33 public static void main(String [] args) 34 throws IOException 35 { 36 HSSFCell cell; 37 38 HSSFWorkbook wb = new HSSFWorkbook(); 39 HSSFSheet sheet = wb.createSheet("new sheet"); 40 HSSFRow row = sheet.createRow((short) 0); 41 42 cell = row.createCell((short)0); 43 cell.setCellType(HSSFCell.CELL_TYPE_FORMULA); 44 cell.setCellFormula("HYPERLINK(\"http://127.0.0.1:8080/toto/truc/index.html?test=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"test\")"); 45 46 FileOutputStream fileOut = new FileOutputStream ("workbook.xls"); 47 wb.write(fileOut); 48 fileOut.close(); 49 50 } 51 } 52 | Popular Tags |