apache poi超链接

本文概述

  • Apache POI超链接示例
Apache POI允许我们在电子表格中创建超链?5; 。在单元格中设置网址并单击后重; 定向到服务器非常有用。
【apache poi超链接】请参见下面的示例,在该示例中?c; 我们创建了重定向到srcmini.com的超链接002;
Apache POI超链接示例
package poiexample; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.CellType; public class HyperlinkFormula { public static void main(String[] args) throws IOException { try (HSSFWorkbook wb = new HSSFWorkbook()) { HSSFSheet sheet = wb.createSheet("new sheet"); HSSFRow row = sheet.createRow(0); HSSFCell cell = row.createCell(0); cell.setCellType(CellType.FORMULA); cell.setCellFormula("HYPERLINK(\"http://https://www.srcmini.com/apache-poi-tutorial\", \"click here\")"); try (FileOutputStream fileOut = new FileOutputStream("srcmini.xls")) { wb.write(fileOut); } } } }

输出:
apache poi超链接

文章图片

    推荐阅读