jxl或者POI里是否有对excel超链接的处理

看了POI文档,找到一个LinkedDataFormulaField 和LinkedDataRecord,jxl文档里有 Hyperlink,现在我想对一个excel中的一组sheet做一个索引,方便查找每张sheet,请问这里有没有人做过,看了文档之后还是没有什么头绪,请高人指教!
已经解决了:
[code]
String outputFile="D:/导出接口.xls";
try
{
Workbook wb=Workbook.getWorkbook(new File(outputFile)); //Excel获得文件
//打开一个文件的副本,并且指定数据写回到原文件
WritableWorkbook book=Workbook.createWorkbook(new File(outputFile),wb);
WritableSheet sheet=book.createSheet("导出目标",0); //添加一个工作表
String[] oriSheetNames=wb.getSheetNames(); //获得源excel文件中的所有sheet名称
for(int i=0;i<book.getNumberOfSheets();i++)
{
sheet.addCell(new Label(0,i+1,String.valueOf(i+1))); //第一列写入编号
/**
* public WritableHyperlink(int col,int row,java.lang.String desc,WritableSheet sheet,int destcol,int destrow)
* Constructs a hyperlink to some cells within this workbook
* col - the column containing this hyperlink
* row - the row containing this hyperlink
* desc - the cell contents for this hyperlink
* sheet - the sheet containing the cells to be linked to
* destcol - the column number of the first destination linked cell
* destrow - the row number of the first destination linked cell
* */
sheet.addHyperlink(new WritableHyperlink(1,i+1,oriSheetNames[i],book.getSheet(oriSheetNames[i]),0,0));
book.write();
book.close();
wb.close();
}catch(IOException e)
{
System.out.println("异常: "+e);
}
catch(BiffException e)
{
System.out.println("异常: "+e);
}
catch(RowsExceededException e)
{
System.out.println("异常: "+e);
}
catch(WriteException e)
{
System.out.println("异常: "+e);
}
[/code]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值