本文概述
- Apache POI超链接示例
【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 word文档段落
- apache poi word表格
- apache poi word风格
- apache poi word对齐
- apache poi word提取文本
- apache poi word提取段落
- apache poi和powerpoint
- apache poi创建ms word文档
- apache poi microsoft word文档