<changes>
<release version="3.8-beta4" date="2011-??-??">
+ <action dev="poi-developers" type="add">Support for hyperlinks in SXSSF</action>
<action dev="poi-developers" type="fix">49933 - Word 6/95 documents with sections cause ArrayIndexOutOfBoundsException</action>
<action dev="poi-developers" type="add">51469 - XSSF support for row styles, to match existing HSSF functionality</action>
<action dev="poi-developers" type="fix">51476 - Correct XSSF cell formatting in HTML export</action>
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.
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);
+
}
/**
link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() );
// Add to the lists
- getSheet().setCellHyperlink(link);
+ getSheet().addHyperlink(link);
}
/**
}
/**
- * Returns the underlying hyperlink object
+ * @return the underlying CTHyperlink object
*/
- protected CTHyperlink getCTHyperlink() {
+ public CTHyperlink getCTHyperlink() {
return _ctHyperlink;
}
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);
}
--- /dev/null
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xssf.usermodel.streaming;
+
+import org.apache.poi.ss.usermodel.BaseTestCell;
+import org.apache.poi.ss.usermodel.BaseTestHyperlink;
+import org.apache.poi.xssf.SXSSFITestDataProvider;
+
+/**
+ * Test setting hyperlinks in SXSSF
+ *
+ * @author Yegor Kozlov
+ */
+public class TestSXSSFHyperlink extends BaseTestHyperlink {
+
+ public TestSXSSFHyperlink() {
+ super(SXSSFITestDataProvider.instance);
+ }
+
+}
\ No newline at end of file