diff options
author | Yegor Kozlov <yegor@apache.org> | 2011-07-12 15:18:29 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2011-07-12 15:18:29 +0000 |
commit | 585c3d0e6fe0619f72ee61926238cb4dec4cfde1 (patch) | |
tree | 5507c2547634978a8d0277e3f4ec87d006a63b65 /src/ooxml/java | |
parent | 4951c48fb12cbc65870c21372804f872516036f2 (diff) | |
download | poi-585c3d0e6fe0619f72ee61926238cb4dec4cfde1.tar.gz poi-585c3d0e6fe0619f72ee61926238cb4dec4cfde1.zip |
support for hyperlinks in SXSSF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145629 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java')
4 files changed, 21 insertions, 5 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java index b6423189ac..bd57fc3ded 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java @@ -26,7 +26,8 @@ import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.formula.FormulaParseException; import org.apache.poi.ss.util.CellRangeAddress; -import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType; +import org.apache.poi.ss.util.CellReference; +import org.apache.poi.xssf.usermodel.XSSFHyperlink; /** * Streaming version of XSSFRow implementing the "BigGridDemo" strategy. @@ -570,6 +571,15 @@ public class SXSSFCell implements Cell public void setHyperlink(Hyperlink link) { setProperty(Property.HYPERLINK,link); + + XSSFHyperlink xssfobj = (XSSFHyperlink)link; + // Assign to us + CellReference ref = new CellReference(getRowIndex(), getColumnIndex()); + xssfobj.getCTHyperlink().setRef( ref.formatAsString() ); + + // Add to the lists + ((SXSSFSheet)getSheet())._sh.addHyperlink(xssfobj); + } /** diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java index 42c70e8c83..1185b562a4 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java @@ -917,7 +917,7 @@ public final class XSSFCell implements Cell { link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() ); // Add to the lists - getSheet().setCellHyperlink(link); + getSheet().addHyperlink(link); } /** diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java index c472911e8e..21fd54b844 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java @@ -88,9 +88,9 @@ public class XSSFHyperlink implements Hyperlink { } /** - * Returns the underlying hyperlink object + * @return the underlying CTHyperlink object */ - protected CTHyperlink getCTHyperlink() { + public CTHyperlink getCTHyperlink() { return _ctHyperlink; } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 19ea45a3f1..24cd2ba245 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -2501,7 +2501,13 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { comment.setColumn(cellReference.getCol()); } - protected void setCellHyperlink(XSSFHyperlink hyperlink) { + /** + * Register a hyperlink in the collection of hyperlinks on this sheet + * + * @param hyperlink the link to add + */ + @Internal + public void addHyperlink(XSSFHyperlink hyperlink) { hyperlinks.add(hyperlink); } |