开发者

Problems creating hyperlinks using Apache POI 3.8-beta4 in a SXSSF workbook

It appears that hyperlink cells are not created correctly when using the POI SXSSF implementation. I have taken an exact copy of the example code from the HOW-TO guide for creating hyperlinks and changed the workbook to开发者_Go百科 be SXSSF instead of XSSF, and the hyperlinks no longer function.

Has anyone else seen this problem or discovered a workaround?

Thanks,

Mark.


SXSSF is quite new, and currently aimed at only certain tasks. If you can, I'd advise you to look at how XSSF does it, and submit a patch!

In the mean time, you can probably get away with using the HYPERLINK function instead. Set your cell to be a formula cell, and set the Formula to be something like HYPERLINK('http://stackoverflow.com/','Stack Overflow') and it'll show as a link in Excel

Update: Support was added to SXSSF to support hyperlinks in r1145629


I know this is an old post, but it came up repeatedly while I was doing searches on the same subject.

I'm using POI 3.9X and it does work with hyperlinks, however there is a big downside if you are using really large amounts of rows with a hyperlink.

  1. there is a limit of 65K hyperlinks per sheet in Excel
  2. If you decide to break your workbook into sheets after the 65K mark the total number of hyperlink objects stays in memory (say if using 1 per row), which can cause a huge spike if iterating quickly and can cause Out of Memory errors if not enough Heap... by huge , I mean gigabytes for 200,000 rows.
  3. The use of the formula method DOES work, and I switched to it as it does not have the limitations of creating a hyperlink object that stays in memory when using SXSSF. This is assuming dealing with a URL and not a relation. For those that see a "0" based on the previous example, make sure to include the "=" before the Hyperlink Excel function
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜